Commit 9a10e025 authored by BERJON Matthieu's avatar BERJON Matthieu

Add the legacy database model

I added the legacy database model into the app.

In order to do that I:

- created the urls.py and views.py file (required by Django)
- created the legacy model using the inspectdb tools given by Django and
stored in models.py
- followed the process to initialize the migrations at the stage of the
model (resulting in the creation of the migrations folder)
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent d23c54b9
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-03-16 13:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ArInternalMetadata',
fields=[
('key', models.CharField(max_length=255, primary_key=True, serialize=False)),
('value', models.CharField(blank=True, max_length=255, null=True)),
('created_at', models.DateTimeField()),
('updated_at', models.DateTimeField()),
],
options={
'db_table': 'ar_internal_metadata',
},
),
migrations.CreateModel(
name='Datasets',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('size', models.IntegerField(blank=True, null=True)),
('extension', models.CharField(blank=True, max_length=255, null=True)),
('user_id', models.IntegerField(blank=True, null=True)),
('created_at', models.DateTimeField()),
('updated_at', models.DateTimeField()),
('file_name', models.CharField(blank=True, max_length=255, null=True)),
],
options={
'db_table': 'datasets',
},
),
migrations.CreateModel(
name='DockerOs',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=255, null=True)),
('version', models.CharField(blank=True, max_length=255, null=True)),
('docker_name', models.CharField(blank=True, max_length=255, null=True)),
],
options={
'db_table': 'docker_os',
},
),
migrations.CreateModel(
name='JobQueues',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('timeout', models.IntegerField(blank=True, null=True)),
('is_default', models.IntegerField()),
('created_at', models.DateTimeField()),
('updated_at', models.DateTimeField()),
],
options={
'db_table': 'job_queues',
},
),
migrations.CreateModel(
name='Jobs',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('webapp_id', models.IntegerField(blank=True, null=True)),
('user_id', models.IntegerField(blank=True, null=True)),
('created_at', models.DateTimeField(blank=True, null=True)),
('updated_at', models.DateTimeField(blank=True, null=True)),
('param', models.CharField(blank=True, max_length=255, null=True)),
('datasize', models.IntegerField(blank=True, null=True)),
('version', models.CharField(blank=True, max_length=255, null=True)),
('exec_time', models.IntegerField(blank=True, null=True)),
('size_generated_data', models.IntegerField(blank=True, null=True)),
('ipaddress', models.CharField(blank=True, max_length=255, null=True)),
('access_token', models.CharField(blank=True, max_length=255, null=True)),
('state', models.IntegerField()),
('container_id', models.CharField(blank=True, max_length=64, null=True)),
('queue_id', models.IntegerField()),
('result', models.IntegerField()),
],
options={
'db_table': 'jobs',
},
),
migrations.CreateModel(
name='JobUploads',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('job_file_file_name', models.CharField(blank=True, max_length=255, null=True)),
('job_file_content_type', models.CharField(blank=True, max_length=255, null=True)),
('job_file_file_size', models.IntegerField(blank=True, null=True)),
('job_file_updated_at', models.DateTimeField(blank=True, null=True)),
('type', models.CharField(blank=True, max_length=255, null=True)),
('job_id', models.IntegerField(blank=True, null=True)),
],
options={
'db_table': 'job_uploads',
},
),
migrations.CreateModel(
name='Quotas',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('user_id', models.IntegerField()),
('webapp_id', models.IntegerField()),
('quantity', models.BigIntegerField(blank=True, null=True)),
('created_at', models.DateTimeField(blank=True, null=True)),
('updated_at', models.DateTimeField(blank=True, null=True)),
],
options={
'db_table': 'quotas',
},
),
migrations.CreateModel(
name='SchemaMigrations',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('version', models.CharField(max_length=255, unique=True)),
],
options={
'db_table': 'schema_migrations',
},
),
migrations.CreateModel(
name='Taggings',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tag_id', models.IntegerField(blank=True, null=True)),
('taggable_id', models.IntegerField(blank=True, null=True)),
('taggable_type', models.CharField(blank=True, max_length=255, null=True)),
('tagger_id', models.IntegerField(blank=True, null=True)),
('tagger_type', models.CharField(blank=True, max_length=255, null=True)),
('context', models.CharField(blank=True, max_length=128, null=True)),
('created_at', models.DateTimeField(blank=True, null=True)),
],
options={
'db_table': 'taggings',
},
),
migrations.CreateModel(
name='Tags',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=255, null=True, unique=True)),
('taggings_count', models.IntegerField(blank=True, null=True)),
],
options={
'db_table': 'tags',
},
),
migrations.CreateModel(
name='Users',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.CharField(max_length=255, unique=True)),
('encrypted_password', models.CharField(max_length=255)),
('reset_password_token', models.CharField(blank=True, max_length=255, null=True, unique=True)),
('reset_password_sent_at', models.DateTimeField(blank=True, null=True)),
('remember_created_at', models.DateTimeField(blank=True, null=True)),
('sign_in_count', models.IntegerField()),
('current_sign_in_at', models.DateTimeField(blank=True, null=True)),
('last_sign_in_at', models.DateTimeField(blank=True, null=True)),
('current_sign_in_ip', models.CharField(blank=True, max_length=255, null=True)),
('last_sign_in_ip', models.CharField(blank=True, max_length=255, null=True)),
('created_at', models.DateTimeField(blank=True, null=True)),
('updated_at', models.DateTimeField(blank=True, null=True)),
('admin', models.IntegerField(blank=True, null=True)),
('confirmation_token', models.CharField(blank=True, max_length=255, null=True, unique=True)),
('confirmed_at', models.DateTimeField(blank=True, null=True)),
('confirmation_sent_at', models.DateTimeField(blank=True, null=True)),
('sshkey', models.TextField(blank=True, null=True)),
('auth_token', models.CharField(blank=True, max_length=255, null=True)),
],
options={
'db_table': 'users',
},
),
migrations.CreateModel(
name='WebappDemos',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=255, null=True)),
('extension', models.CharField(blank=True, max_length=255, null=True)),
('webapp_id', models.IntegerField(blank=True, null=True)),
('file_type', models.CharField(blank=True, max_length=255, null=True)),
],
options={
'db_table': 'webapp_demos',
},
),
migrations.CreateModel(
name='WebappParameters',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('value', models.CharField(blank=True, max_length=255, null=True)),
('name', models.CharField(blank=True, max_length=255, null=True)),
('detail', models.CharField(blank=True, max_length=255, null=True)),
('webapp_id', models.IntegerField(blank=True, null=True)),
],
options={
'db_table': 'webapp_parameters',
},
),
migrations.CreateModel(
name='Webapps',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=255, null=True, unique=True)),
('description', models.TextField(blank=True, null=True)),
('contact', models.CharField(blank=True, max_length=255, null=True)),
('created_at', models.DateTimeField(blank=True, null=True)),
('updated_at', models.DateTimeField(blank=True, null=True)),
('logo_file_name', models.CharField(blank=True, max_length=255, null=True)),
('logo_content_type', models.CharField(blank=True, max_length=255, null=True)),
('logo_file_size', models.IntegerField(blank=True, null=True)),
('logo_updated_at', models.DateTimeField(blank=True, null=True)),
('user_id', models.IntegerField(blank=True, null=True)),
('default_quota', models.IntegerField(blank=True, null=True)),
('docker_os_id', models.IntegerField(blank=True, null=True)),
('docker_name', models.CharField(blank=True, max_length=255, null=True)),
('readme', models.IntegerField(blank=True, null=True)),
('entrypoint', models.CharField(blank=True, max_length=255, null=True)),
('exec_time', models.IntegerField(blank=True, null=True)),
('private', models.IntegerField(blank=True, null=True)),
('access_token', models.CharField(blank=True, max_length=255, null=True)),
('sandbox_state', models.IntegerField()),
('sandbox_version_id', models.IntegerField(blank=True, null=True)),
('default_job_queue_id', models.IntegerField()),
('memory_limit', models.BigIntegerField(blank=True, null=True)),
],
options={
'db_table': 'webapps',
},
),
migrations.CreateModel(
name='WebappVersions',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('number', models.CharField(blank=True, max_length=255, null=True)),
('changelog', models.CharField(blank=True, max_length=255, null=True)),
('created_at', models.DateTimeField(blank=True, null=True)),
('updated_at', models.DateTimeField(blank=True, null=True)),
('webapp_id', models.IntegerField(blank=True, null=True)),
('docker_image_size', models.FloatField(blank=True, null=True)),
('state', models.IntegerField()),
('published', models.IntegerField()),
],
options={
'db_table': 'webapp_versions',
},
),
migrations.AlterUniqueTogether(
name='taggings',
unique_together=set([('tag_id', 'taggable_id', 'taggable_type', 'context', 'tagger_id', 'tagger_type')]),
),
]
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey has `on_delete` set to the desired behavior.
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from __future__ import unicode_literals
from django.db import models
class ArInternalMetadata(models.Model):
key = models.CharField(primary_key=True, max_length=255)
value = models.CharField(max_length=255, blank=True, null=True)
created_at = models.DateTimeField()
updated_at = models.DateTimeField()
class Meta:
db_table = 'ar_internal_metadata'
class Users(models.Model):
email = models.CharField(unique=True, max_length=255)
encrypted_password = models.CharField(max_length=255)
reset_password_token = models.CharField(unique=True, max_length=255, blank=True, null=True)
reset_password_sent_at = models.DateTimeField(blank=True, null=True)
remember_created_at = models.DateTimeField(blank=True, null=True)
sign_in_count = models.IntegerField()
current_sign_in_at = models.DateTimeField(blank=True, null=True)
last_sign_in_at = models.DateTimeField(blank=True, null=True)
current_sign_in_ip = models.CharField(max_length=255, blank=True, null=True)
last_sign_in_ip = models.CharField(max_length=255, blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
updated_at = models.DateTimeField(blank=True, null=True)
admin = models.IntegerField(blank=True, null=True)
confirmation_token = models.CharField(unique=True, max_length=255, blank=True, null=True)
confirmed_at = models.DateTimeField(blank=True, null=True)
confirmation_sent_at = models.DateTimeField(blank=True, null=True)
sshkey = models.TextField(blank=True, null=True)
auth_token = models.CharField(max_length=255, blank=True, null=True)
class Meta:
db_table = 'users'
class Webapps(models.Model):
name = models.CharField(unique=True, max_length=255, blank=True, null=True)
description = models.TextField(blank=True, null=True)
contact = models.CharField(max_length=255, blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
updated_at = models.DateTimeField(blank=True, null=True)
logo_file_name = models.CharField(max_length=255, blank=True, null=True)
logo_content_type = models.CharField(max_length=255, blank=True, null=True)
logo_file_size = models.IntegerField(blank=True, null=True)
logo_updated_at = models.DateTimeField(blank=True, null=True)
user_id = models.IntegerField(blank=True, null=True)
default_quota = models.IntegerField(blank=True, null=True)
docker_os_id = models.IntegerField(blank=True, null=True)
docker_name = models.CharField(max_length=255, blank=True, null=True)
readme = models.IntegerField(blank=True, null=True)
entrypoint = models.CharField(max_length=255, blank=True, null=True)
exec_time = models.IntegerField(blank=True, null=True)
private = models.IntegerField(blank=True, null=True)
access_token = models.CharField(max_length=255, blank=True, null=True)
sandbox_state = models.IntegerField()
sandbox_version_id = models.IntegerField(blank=True, null=True)
default_job_queue_id = models.IntegerField()
memory_limit = models.BigIntegerField(blank=True, null=True)
class Meta:
db_table = 'webapps'
class Datasets(models.Model):
name = models.CharField(max_length=255)
size = models.IntegerField(blank=True, null=True)
extension = models.CharField(max_length=255, blank=True, null=True)
user_id = models.IntegerField(blank=True, null=True)
created_at = models.DateTimeField()
updated_at = models.DateTimeField()
file_name = models.CharField(max_length=255, blank=True, null=True)
class Meta:
db_table = 'datasets'
class DockerOs(models.Model):
name = models.CharField(max_length=255, blank=True, null=True)
version = models.CharField(max_length=255, blank=True, null=True)
docker_name = models.CharField(max_length=255, blank=True, null=True)
class Meta:
db_table = 'docker_os'
class JobQueues(models.Model):
name = models.CharField(max_length=255)
timeout = models.IntegerField(blank=True, null=True)
is_default = models.IntegerField()
created_at = models.DateTimeField()
updated_at = models.DateTimeField()
class Meta:
db_table = 'job_queues'
class JobUploads(models.Model):
job_file_file_name = models.CharField(max_length=255, blank=True, null=True)
job_file_content_type = models.CharField(max_length=255, blank=True, null=True)
job_file_file_size = models.IntegerField(blank=True, null=True)
job_file_updated_at = models.DateTimeField(blank=True, null=True)
type = models.CharField(max_length=255, blank=True, null=True)
job_id = models.IntegerField(blank=True, null=True)
class Meta:
db_table = 'job_uploads'
class Jobs(models.Model):
webapp_id = models.IntegerField(blank=True, null=True)
user_id = models.IntegerField(blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
updated_at = models.DateTimeField(blank=True, null=True)
param = models.CharField(max_length=255, blank=True, null=True)
datasize = models.IntegerField(blank=True, null=True)
version = models.CharField(max_length=255, blank=True, null=True)
exec_time = models.IntegerField(blank=True, null=True)
size_generated_data = models.IntegerField(blank=True, null=True)
ipaddress = models.CharField(max_length=255, blank=True, null=True)
access_token = models.CharField(max_length=255, blank=True, null=True)
state = models.IntegerField()
container_id = models.CharField(max_length=64, blank=True, null=True)
queue_id = models.IntegerField()
result = models.IntegerField()
class Meta:
db_table = 'jobs'
class Quotas(models.Model):
#user_id = models.IntegerField()
webapp_id = models.IntegerField()
quantity = models.BigIntegerField(blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
updated_at = models.DateTimeField(blank=True, null=True)
# Relationships
user = models.ForeignKey(Users, on_delete=models.CASCADE, null=True)
# webapp_id = models.ForeignKey(Webapps, on_delete=models.CASCADE, null=True)
class Meta:
db_table = 'quotas'
class SchemaMigrations(models.Model):
version = models.CharField(unique=True, max_length=255)
class Meta:
db_table = 'schema_migrations'
class Taggings(models.Model):
tag_id = models.IntegerField(blank=True, null=True)
taggable_id = models.IntegerField(blank=True, null=True)
taggable_type = models.CharField(max_length=255, blank=True, null=True)
tagger_id = models.IntegerField(blank=True, null=True)
tagger_type = models.CharField(max_length=255, blank=True, null=True)
context = models.CharField(max_length=128, blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
class Meta:
db_table = 'taggings'
unique_together = (('tag_id', 'taggable_id', 'taggable_type', 'context', 'tagger_id', 'tagger_type'),)
class Tags(models.Model):
name = models.CharField(unique=True, max_length=255, blank=True, null=True)
taggings_count = models.IntegerField(blank=True, null=True)
class Meta:
db_table = 'tags'
class WebappDemos(models.Model):
name = models.CharField(max_length=255, blank=True, null=True)
extension = models.CharField(max_length=255, blank=True, null=True)
webapp_id = models.IntegerField(blank=True, null=True)
file_type = models.CharField(max_length=255, blank=True, null=True)
class Meta:
db_table = 'webapp_demos'
class WebappParameters(models.Model):
value = models.CharField(max_length=255, blank=True, null=True)
name = models.CharField(max_length=255, blank=True, null=True)
detail = models.CharField(max_length=255, blank=True, null=True)
webapp_id = models.IntegerField(blank=True, null=True)
class Meta:
db_table = 'webapp_parameters'
class WebappVersions(models.Model):
number = models.CharField(max_length=255, blank=True, null=True)
changelog = models.CharField(max_length=255, blank=True, null=True)
created_at = models.DateTimeField(blank=True, null=True)
updated_at = models.DateTimeField(blank=True, null=True)
webapp_id = models.IntegerField(blank=True, null=True)
docker_image_size = models.FloatField(blank=True, null=True)
state = models.IntegerField()
published = models.IntegerField()
class Meta:
db_table = 'webapp_versions'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment