2025-10-15 17:41:05 +02:00

104 lines
3.7 KiB
Python

# Generated by Django 5.1.1 on 2025-10-14 12:55
import django.db.models.deletion
import django.utils.timezone
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="RemoteHost",
fields=[
(
"id",
models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
("name", models.CharField(max_length=100)),
("hostname", models.CharField(max_length=255)),
("port", models.PositiveIntegerField(default=22)),
("username", models.CharField(max_length=100)),
(
"auth_method",
models.CharField(
choices=[
("ssh_key", "SSH Key"),
("agent", "SSH Agent"),
("password", "Password"),
],
default="ssh_key",
max_length=20,
),
),
("key_path", models.CharField(blank=True, max_length=500)),
("strict_host_key_checking", models.BooleanField(default=True)),
("notes", models.TextField(blank=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
],
options={
"ordering": ["name"],
},
),
migrations.CreateModel(
name="CommandLog",
fields=[
(
"id",
models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
("command", models.TextField()),
("args_json", models.JSONField(blank=True, null=True)),
("started_at", models.DateTimeField(default=django.utils.timezone.now)),
("finished_at", models.DateTimeField(blank=True, null=True)),
(
"status",
models.CharField(
choices=[
("running", "Running"),
("ok", "Success"),
("failed", "Failed"),
("canceled", "Canceled"),
("error", "Error"),
],
default="running",
max_length=20,
),
),
("exit_code", models.IntegerField(blank=True, null=True)),
("output_tail", models.TextField(blank=True)),
(
"created_by",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to=settings.AUTH_USER_MODEL,
),
),
(
"host",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="command_logs",
to="remotectl.remotehost",
),
),
],
options={
"ordering": ["-started_at"],
},
),
]