Files
opc-backend/reservations/migrations/0001_initial.py

67 lines
3.6 KiB
Python
Raw Permalink Normal View History

# Generated by Django 4.2.30 on 2026-04-25 09:46
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ReservationResource',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=128)),
('type', models.CharField(choices=[('ACCESS_CONTROL', '门禁通行'), ('MEETING_ROOM', '会议室')], max_length=32)),
('description', models.TextField(blank=True, null=True)),
('capacity', models.IntegerField(blank=True, null=True)),
('location', models.CharField(blank=True, max_length=256, null=True)),
('cover_url', models.CharField(blank=True, max_length=512, null=True)),
('price_per_unit', models.DecimalField(decimal_places=2, default=0.0, max_digits=8)),
('price_unit', models.CharField(default='', max_length=32)),
('is_active', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'db_table': 'reservation_resources',
},
),
migrations.CreateModel(
name='ReservationOrder',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('order_no', models.CharField(max_length=64, unique=True)),
('start_time', models.DateTimeField()),
('end_time', models.DateTimeField()),
('quantity', models.IntegerField(default=1)),
('unit_price', models.DecimalField(decimal_places=2, max_digits=8)),
('total_amount', models.DecimalField(decimal_places=2, max_digits=10)),
('status', models.CharField(choices=[('PENDING_PAY', '待支付'), ('PAID', '已支付'), ('USED', '已使用'), ('REFUNDED', '已退款'), ('CANCELLED', '已取消')], default='PENDING_PAY', max_length=32)),
('wx_prepay_id', models.CharField(blank=True, max_length=128, null=True)),
('wx_transaction_id', models.CharField(blank=True, max_length=128, null=True)),
('paid_at', models.DateTimeField(blank=True, null=True)),
('refund_reason', models.TextField(blank=True, null=True)),
('refund_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)),
('wx_refund_id', models.CharField(blank=True, max_length=128, null=True)),
('refunded_at', models.DateTimeField(blank=True, null=True)),
('qr_code_url', models.CharField(blank=True, max_length=512, null=True)),
('verified_at', models.DateTimeField(blank=True, null=True)),
('remark', models.TextField(blank=True, null=True)),
('is_deleted', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='orders', to='reservations.reservationresource')),
],
options={
'db_table': 'reservation_orders',
},
),
]