Member-only story

Povilas Brilius
1 min readFeb 21, 2021

--

Coding social network tags section — it’s traditional RDBMS like MySQL table via replacement — imagine, user roles, where a role can be assigned to multiple users at once — it’s usually referred to UserRoles table entries, structurally — id, user_id, role_id.

Photo by Philippa Rose-Tite on Unsplash

However, in this case note can have tags Matthew MacDonald Vickie Li. That’s why I organize it in the following usual way:

$this->forge->addField(['id' => ['type' => 'INT','unsigned' => true,'auto_increment' => true,'constraint' => 5,],'user_id' => ['type' => 'INT','unsigned' => true,'contraint' => 5,],'data' => ['type' => 'JSON',],'created_at' => ['type' => 'DATETIME','null' => true,],'updated_at' => ['type' => 'DATETIME','null' => true,],'deleted_at' => ['type' => 'DATETIME','null' => true,]]);$this->forge->addForeignKey('user_id', 'users', 'id');$this->forge->addPrimaryKey('id');$this->forge->createTable('notes');

I think that’s necessary to perform usual php artisan migrate in order to gain competitive advantage which is advertised in any normal ECTS stages studies like college — KTU, VDU — UM.

--

--

Povilas Brilius
Povilas Brilius

Written by Povilas Brilius

PHP Developer in e-commerce and e-loans industry fields.

No responses yet