#Migration setup array of strings

2 messages · Page 1 of 1 (latest)

lilac hatch
#

I am a bit confused (not sure what is the best practice), I have following migration:

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('templates', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('description')->nullable();
            $table->string("filename")->nullable();
            $table->string("visibility")->default("public");
            # tags

I want to add tags to the templates table, tags should be an array of possible strings.
Should I just save the array of string comma separated or should I create a new table called tags and then a pivot table between templates and tags to set up multiple possible tags to templates?

#

I am using Postgres by the way.