shimatta-kenkyusho/shimatta_kenkyusho/parts/migrations/0001_initial.py

158 lines
7.9 KiB
Python
Raw Permalink Normal View History

2021-08-07 17:37:36 +02:00
# Generated by Django 3.2 on 2021-07-31 20:44
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import shimatta_modules.RandomFileName
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='ComponentParameterType',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('parameter_name', models.CharField(max_length=50, unique=True)),
('parameter_description', models.TextField(blank=True, null=True)),
('unit', models.CharField(max_length=10)),
('freetext_parameter', models.BooleanField()),
('engineering_unit', models.BooleanField()),
('it_unit', models.BooleanField()),
],
options={
'ordering': ['parameter_name'],
},
),
migrations.CreateModel(
name='Distributor',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('name', models.CharField(max_length=100, unique=True)),
('website', models.CharField(blank=True, max_length=200, null=True)),
('image', models.ImageField(blank=True, null=True, upload_to=shimatta_modules.RandomFileName.RandomFileName('distributor-logos'))),
('component_link_pattern', models.CharField(blank=True, max_length=255, null=True)),
],
options={
'ordering': ['name'],
},
),
migrations.CreateModel(
name='Manufacturer',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('name', models.CharField(max_length=100, unique=True)),
('website', models.CharField(blank=True, max_length=200, null=True)),
('image', models.ImageField(blank=True, null=True, upload_to=shimatta_modules.RandomFileName.RandomFileName('manufacturer-images'))),
],
options={
'ordering': ['name'],
},
),
migrations.CreateModel(
name='Package',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('name', models.CharField(max_length=50, unique=True)),
('pin_count', models.PositiveIntegerField()),
('smd', models.BooleanField()),
('image', models.ImageField(blank=True, null=True, upload_to=shimatta_modules.RandomFileName.RandomFileName('package-images'))),
],
options={
'ordering': ['name'],
},
),
migrations.CreateModel(
name='Storage',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('name', models.CharField(max_length=100, validators=[django.core.validators.RegexValidator('^[^/]*$', 'Slashes are not allowed in storage names')])),
('parent_storage', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='parts.storage')),
('responsible', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['name'],
'unique_together': {('name', 'parent_storage')},
},
),
migrations.CreateModel(
name='ComponentType',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('class_name', models.CharField(max_length=50, unique=True)),
('passive', models.BooleanField()),
('possible_parameter', models.ManyToManyField(to='parts.ComponentParameterType')),
],
options={
'ordering': ['class_name'],
},
),
migrations.CreateModel(
name='Component',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('name', models.CharField(max_length=100)),
('description', models.TextField(blank=True, null=True)),
('datasheet_link', models.CharField(blank=True, max_length=300, null=True)),
('image', models.ImageField(blank=True, null=True, upload_to=shimatta_modules.RandomFileName.RandomFileName('component-images'))),
('component_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='parts.componenttype')),
('manufacturer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='parts.manufacturer')),
('package', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='parts.package')),
('pref_distri', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='parts.distributor')),
],
options={
'ordering': ['name', 'manufacturer'],
'unique_together': {('name', 'manufacturer', 'package')},
},
),
migrations.CreateModel(
name='Stock',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('amount', models.PositiveIntegerField()),
('watermark', models.IntegerField()),
('component', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='parts.component')),
('storage', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='parts.storage')),
],
options={
'ordering': ['id'],
'unique_together': {('component', 'storage')},
},
),
migrations.CreateModel(
name='DistributorNum',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('distributor_part_number', models.CharField(max_length=100)),
('component', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parts.component')),
('distributor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parts.distributor')),
],
options={
'ordering': ['distributor_part_number'],
'unique_together': {('component', 'distributor')},
},
),
migrations.CreateModel(
name='ComponentParameter',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('value', models.FloatField()),
('text_value', models.TextField(blank=True, null=True)),
('component', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parts.component')),
('parameter_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parts.componentparametertype')),
],
options={
'ordering': ['id'],
'unique_together': {('component', 'parameter_type')},
},
),
]