django-simplekeys/simplekeys/migrations/0001_initial.py
2024-12-16 23:04:51 -06:00

77 lines
3.0 KiB
Python

# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-19 01:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Key',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('key', models.CharField(default=uuid.uuid4, max_length=40, unique=True)),
('status', models.CharField(choices=[('u', 'Unactivated'), ('s', 'Suspended'), ('a', 'Active')], max_length=1)),
('email', models.EmailField(max_length=254, unique=True)),
('name', models.CharField(max_length=100)),
('organization', models.CharField(max_length=100)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='Limit',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('quota_period', models.CharField(choices=[('d', 'daily'), ('m', 'monthly')], max_length=1)),
('quota_requests', models.PositiveIntegerField()),
('requests_per_second', models.PositiveIntegerField()),
('burst_size', models.PositiveIntegerField()),
],
),
migrations.CreateModel(
name='Tier',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.SlugField(unique=True)),
('name', models.CharField(max_length=50)),
],
),
migrations.CreateModel(
name='Zone',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('slug', models.SlugField(unique=True)),
('name', models.CharField(max_length=50)),
],
),
migrations.AddField(
model_name='limit',
name='tier',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='limits', to='simplekeys.Tier'),
),
migrations.AddField(
model_name='limit',
name='zone',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='limits', to='simplekeys.Zone'),
),
migrations.AddField(
model_name='key',
name='tier',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='keys', to='simplekeys.Tier'),
),
migrations.AlterUniqueTogether(
name='limit',
unique_together=set([('tier', 'zone')]),
),
]