Files
eam-project/assets/migrations/0019_historicalasset.py
T
2025-05-23 14:44:12 +08:00

58 lines
3.4 KiB
Python

# Generated by Django 3.2 on 2023-01-06 07:44
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('vendors', '0008_auto_20230104_1455'),
('products', '0014_historicalproduct'),
('dashboard', '0018_auto_20230104_1455'),
('assets', '0018_auto_20230104_1455'),
]
operations = [
migrations.CreateModel(
name='HistoricalAsset',
fields=[
('status', models.BooleanField(default=True)),
('created_at', models.DateTimeField(blank=True, editable=False)),
('updated_at', models.DateTimeField(blank=True, editable=False)),
('created_by', models.CharField(blank=True, max_length=255, null=True)),
('updated_by', models.CharField(blank=True, max_length=255, null=True)),
('is_deleted', models.BooleanField(default=False)),
('id', models.UUIDField(db_index=True, default=uuid.uuid4, editable=False)),
('name', models.CharField(blank=True, max_length=255, null=True)),
('serial_no', models.CharField(blank=True, max_length=45, null=True)),
('price', models.FloatField(blank=True, null=True)),
('purchase_date', models.DateField(blank=True, null=True)),
('warranty_expiry_date', models.DateField(blank=True, null=True)),
('purchase_type', models.CharField(blank=True, max_length=45, null=True)),
('description', models.TextField(blank=True, null=True)),
('is_assigned', models.BooleanField(default=False)),
('history_id', models.AutoField(primary_key=True, serialize=False)),
('history_date', models.DateTimeField(db_index=True)),
('history_change_reason', models.CharField(max_length=100, null=True)),
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
('location', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='dashboard.location')),
('organization', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='dashboard.organization')),
('product', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='products.product')),
('vendor', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='vendors.vendor')),
],
options={
'verbose_name': 'historical asset',
'verbose_name_plural': 'historical assets',
'ordering': ('-history_date', '-history_id'),
'get_latest_by': ('history_date', 'history_id'),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
]