243 lines
12 KiB
Python
243 lines
12 KiB
Python
# Generated by Django 2.2.1 on 2019-06-02 10:22
|
|
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Address',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('address', models.CharField(max_length=200)),
|
|
('zip_code', models.CharField(max_length=10)),
|
|
('city', models.CharField(max_length=200)),
|
|
('country', models.CharField(max_length=200)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Bill',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('num', models.IntegerField()),
|
|
('date', models.DateTimeField()),
|
|
('total', models.DecimalField(decimal_places=2, max_digits=7)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Boat',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=50)),
|
|
('registration_num', models.CharField(max_length=20, null=True)),
|
|
('length', models.DecimalField(decimal_places=2, max_digits=7, null=True)),
|
|
('beam', models.DecimalField(decimal_places=2, max_digits=7, null=True)),
|
|
('water_draught', models.DecimalField(decimal_places=2, max_digits=7, null=True)),
|
|
('tonnage', models.DecimalField(decimal_places=2, max_digits=7, null=True)),
|
|
('water_tank', models.DecimalField(decimal_places=2, max_digits=7, null=True)),
|
|
('model', models.CharField(max_length=50, null=True)),
|
|
('heating', models.CharField(max_length=50, null=True)),
|
|
('passenger_capacity', models.IntegerField(null=True)),
|
|
('picture', models.ImageField(null=True, upload_to='uploads/')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Company',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=50)),
|
|
('email', models.EmailField(max_length=200, null=True)),
|
|
('phone', models.CharField(max_length=20, null=True)),
|
|
('registration_num', models.CharField(max_length=50, null=True)),
|
|
('address', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='port.Address')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Dock',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('num', models.CharField(max_length=10)),
|
|
('length', models.DecimalField(decimal_places=2, max_digits=7, null=True)),
|
|
('width', models.DecimalField(decimal_places=2, max_digits=7, null=True)),
|
|
('depth', models.DecimalField(decimal_places=2, max_digits=7, null=True)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Employee',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('position', models.CharField(max_length=20, null=True, verbose_name='Job')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Payment',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('num', models.CharField(max_length=40)),
|
|
('date', models.DateTimeField()),
|
|
('amount', models.DecimalField(decimal_places=2, max_digits=7)),
|
|
('pay_type', models.CharField(choices=[('CSH', 'Cash'), ('CHK', 'Check'), ('TSF', 'Transfer'), ('CRD', 'Credit Card')], default='CSH', max_length=3)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Person',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=50, null=True)),
|
|
('surname', models.CharField(max_length=50, null=True)),
|
|
('nationality', models.CharField(max_length=200, null=True)),
|
|
('email', models.EmailField(max_length=254, null=True)),
|
|
('phone', models.CharField(max_length=20, null=True)),
|
|
('address', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='port.Address')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Port',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=50)),
|
|
('address', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Address')),
|
|
('company', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Company')),
|
|
('employees', models.ManyToManyField(through='port.Employee', to='port.Person')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Service',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=50)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Insurance',
|
|
fields=[
|
|
('company_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='port.Company')),
|
|
],
|
|
bases=('port.company',),
|
|
),
|
|
migrations.CreateModel(
|
|
name='Tap',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('num', models.CharField(max_length=10)),
|
|
('port', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Port')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Stay',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('arrival', models.DateTimeField()),
|
|
('departure', models.DateTimeField(null=True)),
|
|
('coming_from', models.CharField(max_length=200, null=True)),
|
|
('going_to', models.CharField(max_length=200, null=True)),
|
|
('bill', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='port.Bill')),
|
|
('boat', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Boat')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='SailsOn',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('is_captain', models.BooleanField()),
|
|
('is_crew', models.BooleanField()),
|
|
('is_owner', models.BooleanField()),
|
|
('is_guest', models.BooleanField()),
|
|
('is_pet', models.BooleanField()),
|
|
('boat', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Boat')),
|
|
('person', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Person')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Plug',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('num', models.CharField(max_length=10)),
|
|
('amperage', models.DecimalField(decimal_places=2, max_digits=7)),
|
|
('voltage', models.DecimalField(decimal_places=2, max_digits=7)),
|
|
('port', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Port')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Mooring',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('date', models.DateTimeField()),
|
|
('dock', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Dock')),
|
|
('plug', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='port.Plug')),
|
|
('stay', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='port.Stay')),
|
|
('tap', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='port.Tap')),
|
|
],
|
|
),
|
|
migrations.AddField(
|
|
model_name='employee',
|
|
name='person',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Person'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='employee',
|
|
name='port',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Port'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='dock',
|
|
name='port',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Port'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='boat',
|
|
name='company',
|
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='port.Company'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='boat',
|
|
name='persons',
|
|
field=models.ManyToManyField(through='port.SailsOn', to='port.Person'),
|
|
),
|
|
migrations.CreateModel(
|
|
name='BillPayment',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('amount', models.DecimalField(decimal_places=2, max_digits=7)),
|
|
('bill', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Bill')),
|
|
('payment', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Payment')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='BillLine',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('quantity', models.DecimalField(decimal_places=2, max_digits=7)),
|
|
('bill', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Bill')),
|
|
('service', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Service')),
|
|
],
|
|
),
|
|
migrations.AddField(
|
|
model_name='bill',
|
|
name='payments',
|
|
field=models.ManyToManyField(through='port.BillPayment', to='port.Payment'),
|
|
),
|
|
migrations.CreateModel(
|
|
name='BoatInsurance',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('contract', models.IntegerField(null=True)),
|
|
('date', models.DateTimeField(auto_now_add=True)),
|
|
('boat', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Boat')),
|
|
('insurance', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='port.Insurance')),
|
|
],
|
|
),
|
|
migrations.AddField(
|
|
model_name='boat',
|
|
name='boat_insurance',
|
|
field=models.ManyToManyField(through='port.BoatInsurance', to='port.Insurance'),
|
|
),
|
|
]
|