summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2025-07-02 17:39:41 +0530
committerSunil Shetye2025-07-02 22:21:38 +0530
commit4d8a0edf014bf0947a3eede1f6102f46eff58e52 (patch)
tree74b178ab4441e504197d7e2eed6ce033de603803
parentee13ca4a5dd60ee481ff421d92e4a4aa90f63c57 (diff)
downloadCommon-Interface-Project-4d8a0edf014bf0947a3eede1f6102f46eff58e52.tar.gz
Common-Interface-Project-4d8a0edf014bf0947a3eede1f6102f46eff58e52.tar.bz2
Common-Interface-Project-4d8a0edf014bf0947a3eede1f6102f46eff58e52.zip
adding migrations for docker
-rw-r--r--.gitignore2
-rw-r--r--blocks/.dockerignore1
-rw-r--r--blocks/authAPI/migrations/0001_initial.py39
-rw-r--r--blocks/authAPI/migrations/__init__.py0
-rw-r--r--blocks/blocks/xcosblocks/migrations/0001_initial.py106
-rw-r--r--blocks/blocks/xcosblocks/migrations/__init__.py0
-rwxr-xr-xblocks/init.sh3
-rwxr-xr-xblocks/install.sh1
-rw-r--r--blocks/saveAPI/migrations/0001_initial.py70
-rw-r--r--blocks/saveAPI/migrations/__init__.py0
-rw-r--r--blocks/simulationAPI/migrations/0001_initial.py46
-rw-r--r--blocks/simulationAPI/migrations/__init__.py0
12 files changed, 262 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index f888162b..bc8c53c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,8 +5,6 @@
.srcflake8
.xcosblocks.txt
__pycache__/
-blocks/blocks/*/migrations/*.py
-blocks/*/migrations/*.py
blocks/env*/
.DS_Store
.env
diff --git a/blocks/.dockerignore b/blocks/.dockerignore
index 8e95efa9..a6b15fad 100644
--- a/blocks/.dockerignore
+++ b/blocks/.dockerignore
@@ -8,7 +8,6 @@ env*
*.pyc
*.sqlite3
*.swp
-**/migrations
.DS_Store
**/.env.*
**/build
diff --git a/blocks/authAPI/migrations/0001_initial.py b/blocks/authAPI/migrations/0001_initial.py
new file mode 100644
index 00000000..55814378
--- /dev/null
+++ b/blocks/authAPI/migrations/0001_initial.py
@@ -0,0 +1,39 @@
+# Generated by Django 4.2.22 on 2025-07-02 12:01
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ('auth', '0012_alter_user_first_name_max_length'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='User',
+ fields=[
+ ('password', models.CharField(max_length=128, verbose_name='password')),
+ ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
+ ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
+ ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
+ ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
+ ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
+ ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
+ ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('email', models.EmailField(max_length=150, unique=True)),
+ ('username', models.CharField(max_length=150, unique=True)),
+ ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
+ ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
+ ],
+ options={
+ 'verbose_name': 'user',
+ 'verbose_name_plural': 'users',
+ 'abstract': False,
+ },
+ ),
+ ]
diff --git a/blocks/authAPI/migrations/__init__.py b/blocks/authAPI/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/blocks/authAPI/migrations/__init__.py
diff --git a/blocks/blocks/xcosblocks/migrations/0001_initial.py b/blocks/blocks/xcosblocks/migrations/0001_initial.py
new file mode 100644
index 00000000..6309ea1c
--- /dev/null
+++ b/blocks/blocks/xcosblocks/migrations/0001_initial.py
@@ -0,0 +1,106 @@
+# Generated by Django 4.2.22 on 2025-07-02 12:01
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='BlockPrefix',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('name', models.CharField(max_length=100, unique=True)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='BlockType',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('name', models.CharField(max_length=100, unique=True)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Category',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('name', models.CharField(max_length=100)),
+ ('sort_order', models.IntegerField()),
+ ('blocktype', models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='xcosblocks.blocktype')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='NewBlock',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('name', models.CharField(max_length=100)),
+ ('block_name', models.CharField(max_length=200, null=True, unique=True)),
+ ('initial_display_parameter', models.CharField(blank=True, max_length=100, null=True)),
+ ('simulation_function', models.CharField(blank=True, max_length=100, null=True)),
+ ('block_image_path', models.CharField(blank=True, max_length=100, null=True)),
+ ('block_width', models.IntegerField(default=40)),
+ ('block_height', models.IntegerField(default=40)),
+ ('super_block', models.CharField(max_length=10000, null=True)),
+ ('blockprefix', models.ForeignKey(default=1, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='xcosblocks.blockprefix')),
+ ('categories', models.ManyToManyField(to='xcosblocks.category')),
+ ('main_category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='xcosblocks.category')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='ParameterDataType',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('name', models.CharField(max_length=100, unique=True)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='NewBlockPort',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('port_order', models.IntegerField()),
+ ('port_name', models.CharField(max_length=100)),
+ ('port_number', models.CharField(max_length=10)),
+ ('port_x', models.IntegerField(default=1)),
+ ('port_y', models.IntegerField(default=1)),
+ ('port_orientation', models.CharField(max_length=100)),
+ ('port_part', models.IntegerField(default=1)),
+ ('port_dmg', models.IntegerField(default=1)),
+ ('port_type', models.CharField(max_length=100)),
+ ('block', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='xcosblocks.newblock')),
+ ],
+ ),
+ migrations.CreateModel(
+ name='NewBlockParameter',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('p_order', models.IntegerField()),
+ ('p_label', models.CharField(max_length=100)),
+ ('p_help', models.CharField(blank=True, max_length=100, null=True)),
+ ('p_value_initial', models.CharField(blank=True, max_length=100)),
+ ('block', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='xcosblocks.newblock')),
+ ('p_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='+', to='xcosblocks.parameterdatatype')),
+ ],
+ ),
+ migrations.AddConstraint(
+ model_name='newblockport',
+ constraint=models.UniqueConstraint(fields=('block', 'port_order'), name='unique_blocktemp_port_order'),
+ ),
+ migrations.AddConstraint(
+ model_name='newblockparameter',
+ constraint=models.UniqueConstraint(fields=('block', 'p_order'), name='unique_block_p_order'),
+ ),
+ migrations.AddConstraint(
+ model_name='newblock',
+ constraint=models.UniqueConstraint(fields=('main_category', 'name'), name='unique_main_category_name'),
+ ),
+ migrations.AddConstraint(
+ model_name='category',
+ constraint=models.UniqueConstraint(fields=('blocktype', 'name'), name='unique_blocktype_name'),
+ ),
+ ]
diff --git a/blocks/blocks/xcosblocks/migrations/__init__.py b/blocks/blocks/xcosblocks/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/blocks/blocks/xcosblocks/migrations/__init__.py
diff --git a/blocks/init.sh b/blocks/init.sh
index 1557ef11..ef98711c 100755
--- a/blocks/init.sh
+++ b/blocks/init.sh
@@ -7,9 +7,8 @@ PASSWORD=''
rm -f xcosblocks.sqlite3
-./manage.py makemigrations -v0
./manage.py migrate -v0
./manage.py loaddata xcosblocks
echo "from authAPI.models import User; User.objects.create_superuser('$EMAIL', '$EMAIL', '$PASSWORD')" |
- ./manage.py shell
+ ./manage.py shell
diff --git a/blocks/install.sh b/blocks/install.sh
index d705ae1a..af54aee2 100755
--- a/blocks/install.sh
+++ b/blocks/install.sh
@@ -17,7 +17,6 @@ sed -i \
mkdir -p file_storage/uploads logs media/saves media/uploads
make -s
-python manage.py makemigrations -v0 saveAPI simulationAPI xcosblocks
python manage.py migrate -v0
python manage.py loaddata -v0 saveAPI xcosblocks
diff --git a/blocks/saveAPI/migrations/0001_initial.py b/blocks/saveAPI/migrations/0001_initial.py
new file mode 100644
index 00000000..146d8321
--- /dev/null
+++ b/blocks/saveAPI/migrations/0001_initial.py
@@ -0,0 +1,70 @@
+# Generated by Django 4.2.22 on 2025-07-02 12:01
+
+from django.conf import settings
+import django.core.files.storage
+from django.db import migrations, models
+import django.db.models.deletion
+import uuid
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Book',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('book_name', models.CharField(max_length=500)),
+ ('author_name', models.CharField(max_length=500)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='BookCategory',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('category_name', models.CharField(max_length=500)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='StateSave',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('save_id', models.UUIDField(default=uuid.uuid4)),
+ ('name', models.CharField(default='Untitled', max_length=100)),
+ ('description', models.CharField(max_length=400, null=True)),
+ ('shared', models.BooleanField(default=False)),
+ ('create_time', models.DateTimeField(auto_now_add=True)),
+ ('save_time', models.DateTimeField(auto_now=True, db_index=True)),
+ ('data_dump', models.TextField()),
+ ('base64_image', models.ImageField(null=True, storage=django.core.files.storage.FileSystemStorage(base_url='/files', location='/home/sunil/git/xcosblocks/blocks/file_storage'), upload_to='simulation_images')),
+ ('script_dump', models.TextField(null=True)),
+ ('owner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Gallery',
+ fields=[
+ ('id', models.AutoField(primary_key=True, serialize=False)),
+ ('save_id', models.CharField(max_length=50, unique=True)),
+ ('name', models.CharField(default='Untitled', max_length=100)),
+ ('description', models.CharField(max_length=400, null=True)),
+ ('save_time', models.DateTimeField(auto_now=True)),
+ ('data_dump', models.TextField()),
+ ('blocks', models.CharField(max_length=300, null=True)),
+ ('media', models.CharField(max_length=100, null=True)),
+ ('script_dump', models.TextField(null=True)),
+ ('book', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='examples', to='saveAPI.book')),
+ ],
+ ),
+ migrations.AddField(
+ model_name='book',
+ name='category',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='saveAPI.bookcategory'),
+ ),
+ ]
diff --git a/blocks/saveAPI/migrations/__init__.py b/blocks/saveAPI/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/blocks/saveAPI/migrations/__init__.py
diff --git a/blocks/simulationAPI/migrations/0001_initial.py b/blocks/simulationAPI/migrations/0001_initial.py
new file mode 100644
index 00000000..932a7237
--- /dev/null
+++ b/blocks/simulationAPI/migrations/0001_initial.py
@@ -0,0 +1,46 @@
+# Generated by Django 4.2.22 on 2025-07-02 12:01
+
+import django.core.files.storage
+from django.db import migrations, models
+import django.db.models.deletion
+import simulationAPI.models
+import uuid
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Session',
+ fields=[
+ ('session_id', models.CharField(editable=False, max_length=40, primary_key=True, serialize=False)),
+ ('app_name', models.CharField(default='', max_length=40)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('expire_at', models.DateTimeField(default=simulationAPI.models.get_expire_at)),
+ ('count', models.IntegerField(default=0)),
+ ],
+ ),
+ migrations.CreateModel(
+ name='Task',
+ fields=[
+ ('task_id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
+ ('file', models.FileField(storage=django.core.files.storage.FileSystemStorage(location='/home/sunil/git/xcosblocks/blocks/file_storage'), upload_to='')),
+ ('type', models.CharField(choices=[('XCOS', 'Xcos'), ('SCRIPT', 'Scilab Script')], default='XCOS', max_length=20)),
+ ('status', models.CharField(choices=[('PENDING', 'Pending'), ('STARTED', 'Started'), ('STREAMING', 'Streaming'), ('SUCCESS', 'Success'), ('FAILURE', 'Failure'), ('RETRY', 'Retry'), ('CANCELED', 'Canceled')], default='PENDING', max_length=20)),
+ ('parameters', models.TextField(blank=True, null=True)),
+ ('upload_time', models.DateTimeField(auto_now=True)),
+ ('log_name', models.CharField(blank=True, max_length=500, null=True)),
+ ('script_task_id', models.CharField(blank=True, max_length=40, null=True)),
+ ('workspace_file', models.CharField(blank=True, max_length=500, null=True)),
+ ('returncode', models.IntegerField(blank=True, null=True)),
+ ('start_time', models.DateTimeField(null=True)),
+ ('end_time', models.DateTimeField(null=True)),
+ ('session', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='task', to='simulationAPI.session')),
+ ],
+ ),
+ ]
diff --git a/blocks/simulationAPI/migrations/__init__.py b/blocks/simulationAPI/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/blocks/simulationAPI/migrations/__init__.py