38359-vm/core/migrations/0001_initial.py
2026-02-11 12:56:44 +00:00

77 lines
3.8 KiB
Python

# Generated by Django 5.2.7 on 2026-02-11 12:10
import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('slug', models.SlugField(blank=True, unique=True)),
],
options={
'verbose_name_plural': 'Categories',
},
),
migrations.CreateModel(
name='Channel',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('description', models.TextField(blank=True)),
('handle', models.CharField(max_length=100, unique=True)),
('thumbnail', models.ImageField(blank=True, null=True, upload_to='channels/thumbnails/')),
('banner', models.ImageField(blank=True, null=True, upload_to='channels/banners/')),
('created_at', models.DateTimeField(auto_now_add=True)),
('subscribers', models.ManyToManyField(blank=True, related_name='subscriptions', to=settings.AUTH_USER_MODEL)),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='channel', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='LiveStream',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('title', models.CharField(max_length=255)),
('description', models.TextField(blank=True)),
('thumbnail', models.ImageField(upload_to='live/thumbnails/')),
('stream_key', models.CharField(default=uuid.uuid4, max_length=100, unique=True)),
('is_live', models.BooleanField(default=False)),
('viewer_count', models.PositiveIntegerField(default=0)),
('created_at', models.DateTimeField(auto_now_add=True)),
('channel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='live_streams', to='core.channel')),
],
),
migrations.CreateModel(
name='Video',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('title', models.CharField(max_length=255)),
('description', models.TextField(blank=True)),
('thumbnail', models.ImageField(upload_to='videos/thumbnails/')),
('video_file', models.FileField(blank=True, null=True, upload_to='videos/raw/')),
('hls_url', models.URLField(blank=True, help_text='S3/CloudFront HLS URL', null=True)),
('views', models.PositiveIntegerField(default=0)),
('is_published', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='videos', to='core.category')),
('channel', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='videos', to='core.channel')),
],
options={
'ordering': ['-created_at'],
},
),
]