From 18d995e38d77cb99485e785a2f9358c1f09fc702 Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Sun, 23 Jun 2024 22:29:58 -0400 Subject: [PATCH] Start adding the migrations classes. --- .../20240624020713_create_users_table.php | 44 +++++++++++++++++ .../20240624022427_create_images.php | 49 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 app/db/migrations/20240624020713_create_users_table.php create mode 100644 app/db/migrations/20240624022427_create_images.php diff --git a/app/db/migrations/20240624020713_create_users_table.php b/app/db/migrations/20240624020713_create_users_table.php new file mode 100644 index 0000000..ecb3670 --- /dev/null +++ b/app/db/migrations/20240624020713_create_users_table.php @@ -0,0 +1,44 @@ +table("users"); + $table->addColumn('email', 'string') + ->addColumn('name', 'string') + ->addColumn('password', 'string') + ->addIndex([ 'email' ], [ 'unique' => true ]) + ->create(); + } +} diff --git a/app/db/migrations/20240624022427_create_images.php b/app/db/migrations/20240624022427_create_images.php new file mode 100644 index 0000000..824d951 --- /dev/null +++ b/app/db/migrations/20240624022427_create_images.php @@ -0,0 +1,49 @@ +table('images')->addTimestamps(); + $table->addColumn('url', 'string') + ->addColumn('title', [ 'null' => false ]) + ->addColumn('width', 'integer', [ + 'unsigned' => true, + 'null' => true, + ]) + ->addColumn('height', 'integer', [ + 'unsigned' => true, + 'null' => true + ]) + ->addIndex([ 'url' ], [ 'type' => 'unique' ]) + ->create(); + } +}