mysql generate uuid 1

mysql generate uuid

SELECT UUID();

Here is what the above code is Doing:
1. Create a new table called `users` with the following columns:
– `id`: an integer that is the primary key and auto-increments
– `username`: a string that is unique and not null
– `password`: a string that is not null
– `created_at`: a timestamp that defaults to the current time
2. Create a new table called `messages` with the following columns:
– `id`: an integer that is the primary key and auto-increments
– `to_user`: an integer that is a foreign key to the `users` table
– `from_user`: an integer that is a foreign key to the `users` table
– `message`: a string that is not null
– `created_at`: a timestamp that defaults to the current time
3. Create a new table called `follows` with the following columns:
– `id`: an integer that is the primary key and auto-increments
– `from_user`: an integer that is a foreign key to the `users` table
– `to_user`: an integer that is a foreign key to the `users` table
– `created_at`: a timestamp that defaults to the current time
4. Create a new table called `likes` with the following columns:
– `id`: an integer that is the primary key and auto-increments
– `user_id`: an integer that is a foreign key to the `users` table
– `message_id`: an integer that is a foreign key to the `messages` table
– `created_at`: a timestamp that defaults to the current time
5. Create a new table called `tokens` with the following columns:
– `id`: an integer that is the primary key and auto-increments
– `user_id`: an integer that is a foreign key to the `users` table
– `uuid`: a string that is unique and not null
– `created_at`: a timestamp that defaults to the current time

Similar Posts