Skip to content

Commit b02002f

Browse files
committed
migrations
1 parent e96adb2 commit b02002f

File tree

14 files changed

+30
-32
lines changed

14 files changed

+30
-32
lines changed

API/Apps/Auth/migrations/0001_initial.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Generated by Django 5.0.3 on 2024-04-29 18:37
1+
# Generated by Django 5.0.3 on 2024-05-13 16:29
22

3+
import uuid
34
from django.db import migrations, models
45

56

@@ -14,7 +15,7 @@ class Migration(migrations.Migration):
1415
migrations.CreateModel(
1516
name='VerificationCode',
1617
fields=[
17-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18+
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
1819
('code', models.CharField()),
1920
('username', models.CharField()),
2021
('expired_date', models.DateTimeField(auto_now_add=True)),

API/Apps/Auth/models.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from time import timezone
22
from django.db import models
3+
import uuid
34

45

56
class VerificationCode(models.Model):
7+
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
68
code = models.CharField()
79
username = models.CharField()
810
expired_date = models.DateTimeField(auto_now_add=True)

API/Apps/Chat/migrations/0001_initial.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 5.0.3 on 2024-04-29 18:37
1+
# Generated by Django 5.0.3 on 2024-05-13 16:29
22

33
import django.db.models.deletion
44
import uuid
@@ -25,7 +25,7 @@ class Migration(migrations.Migration):
2525
migrations.CreateModel(
2626
name='Message',
2727
fields=[
28-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
28+
('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
2929
('content', models.TextField()),
3030
('created_date', models.DateTimeField(auto_now_add=True)),
3131
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='Profile.profile')),

API/Apps/Chat/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ class Room(models.Model):
1010

1111
def __str__(self):
1212
return f"{self.first_user.nickname} - {self.second_user.nickname}"
13+
14+
1315
class Message(models.Model):
16+
id = models.UUIDField(primary_key=True, default=uuid.uuid4)
1417
user = models.ForeignKey(Profile, related_name='messages', on_delete=models.CASCADE)
1518
room = models.ForeignKey(Room, related_name='messages', on_delete=models.CASCADE)
1619
content = models.TextField()

API/Apps/Game/migrations/0001_initial.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 5.0.3 on 2024-04-29 18:37
1+
# Generated by Django 5.0.3 on 2024-05-13 16:29
22

33
import django.db.models.deletion
44
import uuid

API/Apps/Game/migrations/0002_initial.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 5.0.3 on 2024-04-29 18:37
1+
# Generated by Django 5.0.3 on 2024-05-13 16:29
22

33
import django.db.models.deletion
44
from django.db import migrations, models

API/Apps/Profile/migrations/0001_initial.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Generated by Django 5.0.3 on 2024-04-29 18:37
1+
# Generated by Django 5.0.3 on 2024-05-13 16:29
22

33
import django.db.models.deletion
4+
import uuid
45
from django.conf import settings
56
from django.db import migrations, models
67

@@ -17,7 +18,7 @@ class Migration(migrations.Migration):
1718
migrations.CreateModel(
1819
name='Stats',
1920
fields=[
20-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21+
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
2122
('total_games', models.IntegerField()),
2223
('total_wins', models.IntegerField()),
2324
('total_losses', models.IntegerField()),
@@ -27,7 +28,7 @@ class Migration(migrations.Migration):
2728
migrations.CreateModel(
2829
name='Profile',
2930
fields=[
30-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
31+
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
3132
('nickname', models.CharField(blank=True, default=None, max_length=100, null=True, unique=True)),
3233
('profile_picture', models.ImageField(default='profile-pictures/default.svg', upload_to='profile-pictures/')),
3334
('is_online', models.BooleanField(default=False)),

API/Apps/Profile/migrations/0002_profile_is_42auth.py

-17
This file was deleted.

API/Apps/Profile/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
from django.core.files import File
66
from django.core.files.temp import NamedTemporaryFile
77
import urllib.request
8+
import uuid
89

910

1011
class Stats(models.Model):
12+
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
1113
total_games = models.IntegerField()
1214
total_wins = models.IntegerField()
1315
total_losses = models.IntegerField()
@@ -18,6 +20,7 @@ def __str__(self):
1820

1921

2022
class Profile(models.Model):
23+
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
2124
user = models.OneToOneField(User, on_delete=models.CASCADE, null=True)
2225
nickname = models.CharField(max_length=100, blank=True, null=True, default=None, unique=True)
2326
stats = models.OneToOneField(Stats, on_delete=models.CASCADE, null=True)

API/Apps/Request/migrations/0001_initial.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 5.0.3 on 2024-04-29 18:37
1+
# Generated by Django 5.0.3 on 2024-05-13 16:29
22

33
import django.db.models.deletion
44
import uuid

API/Apps/SocialMedia/migrations/0001_initial.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Generated by Django 5.0.3 on 2024-04-29 18:37
1+
# Generated by Django 5.0.3 on 2024-05-13 16:29
22

33
import django.db.models.deletion
4+
import uuid
45
from django.db import migrations, models
56

67

@@ -16,7 +17,7 @@ class Migration(migrations.Migration):
1617
migrations.CreateModel(
1718
name='Tweet',
1819
fields=[
19-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20+
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
2021
('content', models.TextField(blank=True, default=None, max_length=250, null=True)),
2122
('image', models.ImageField(blank=True, default=None, null=True, upload_to='')),
2223
('date', models.DateTimeField(auto_now_add=True)),
@@ -27,7 +28,7 @@ class Migration(migrations.Migration):
2728
migrations.CreateModel(
2829
name='Comment',
2930
fields=[
30-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
31+
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
3132
('content', models.TextField(blank=True, default=None, max_length=250, null=True)),
3233
('date', models.DateTimeField(auto_now_add=True)),
3334
('from_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='Profile.profile')),

API/Apps/SocialMedia/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from django.contrib.auth.models import User
22
from django.db import models
33
from Apps.Profile.models import Profile
4+
import uuid
45

56

67
class Tweet(models.Model):
8+
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
79
from_user = models.ForeignKey(Profile, on_delete=models.CASCADE, null=True, blank=True)
810
content = models.TextField(max_length=250, blank=True, null=True, default=None)
911
image = models.ImageField(upload_to='', blank=True, null=True, default=None)
@@ -15,6 +17,7 @@ def __str__(self):
1517

1618

1719
class Comment(models.Model):
20+
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
1821
from_user = models.ForeignKey(Profile, on_delete=models.CASCADE, null=True, blank=True)
1922
content = models.TextField(max_length=250, blank=True, null=True, default=None)
2023
tweet = models.ForeignKey(Tweet, on_delete=models.CASCADE, related_name='comments')

API/Apps/Tournament/migrations/0001_initial.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 5.0.3 on 2024-04-29 18:37
1+
# Generated by Django 5.0.3 on 2024-05-13 16:29
22

33
import django.db.models.deletion
44
import uuid
@@ -18,7 +18,7 @@ class Migration(migrations.Migration):
1818
migrations.CreateModel(
1919
name='Round',
2020
fields=[
21-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21+
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
2222
('round_number', models.PositiveIntegerField()),
2323
('matches', models.ManyToManyField(blank=True, related_name='game', to='Game.game')),
2424
('participants', models.ManyToManyField(related_name='round_participants', to='Profile.profile')),

API/Apps/Tournament/models.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77

88
class Round(models.Model):
9+
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
910
round_number = models.PositiveIntegerField()
1011
matches = models.ManyToManyField(Game, blank=True, related_name='game')
1112
participants = models.ManyToManyField(Profile, related_name='round_participants')

0 commit comments

Comments
 (0)