Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(migrations): add initial migration tracking to the package #21

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,4 @@ manage.py
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Ignore all migrations files except __init__.py
**/migrations/*
!**/migrations/__init__.py
bandit_report.txt
327 changes: 327 additions & 0 deletions sage_seo/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
# Generated by Django 5.1 on 2024-10-03 17:39

import django.core.validators
import django.db.models.deletion
import sage_seo.models.validators
import sage_tools.mixins.models.access
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
("contenttypes", "0002_remove_content_type_name"),
]

operations = [
migrations.CreateModel(
name="MetaInformation",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created_at",
models.DateTimeField(auto_now_add=True, verbose_name="Created at"),
),
(
"modified_at",
models.DateTimeField(auto_now=True, verbose_name="Modified at"),
),
(
"view_name",
models.CharField(
db_comment="The view or route name associated with this meta information.",
help_text="The name of the view or page this meta information applies to.",
max_length=255,
verbose_name="View Name",
),
),
(
"title",
models.CharField(
db_comment="SEO title of the page.",
help_text="The title of the page for SEO purposes.",
max_length=255,
verbose_name="Title",
),
),
(
"description",
models.CharField(
db_comment="SEO description of the page, used in search engine listings.",
help_text="A brief description of the page content for SEO purposes. Ideally 155 to 160 characters.",
max_length=160,
verbose_name="Description",
),
),
(
"keywords",
models.TextField(
db_comment="List of SEO keywords associated with the page.",
help_text="A list of keywords relevant to the page content, used for SEO purposes.",
verbose_name="SEO Keywords",
),
),
(
"json_ld",
models.TextField(
blank=True,
db_comment="JSON-LD structured data for enhancing search engine listings with rich snippets.",
help_text="Structured JSON-LD data for rich snippets. Enter valid JSON.",
null=True,
),
),
(
"index_page",
models.BooleanField(
db_comment="Flag indicating if the page should be indexed by search engines.",
default=True,
help_text="Indicates whether search engines should index this page.",
),
),
(
"follow_page_links",
models.BooleanField(
db_comment="Controls whether search engine crawlers are advised to follow links found on this page.",
default=True,
help_text="Determines if search engine crawlers should follow links on this page. 'True' allows following links, enhancing link equity distribution.",
),
),
(
"canonical_url",
models.URLField(
db_comment="Canonical URL of the page to prevent SEO issues related to duplicate content.",
help_text="The preferred URL for this page, used to avoid duplicate content issues.",
unique=True,
verbose_name="Canonical URL",
),
),
],
options={
"abstract": False,
},
),
migrations.CreateModel(
name="RobotsTxt",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created_at",
models.DateTimeField(auto_now_add=True, verbose_name="Created at"),
),
(
"modified_at",
models.DateTimeField(auto_now=True, verbose_name="Modified at"),
),
("content", models.TextField()),
],
options={
"verbose_name": "Robots.txt",
"verbose_name_plural": "Robots.txt",
},
bases=(sage_tools.mixins.models.access.SingletonModelMixin, models.Model),
),
migrations.CreateModel(
name="ScriptTag",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created_at",
models.DateTimeField(auto_now_add=True, verbose_name="Created at"),
),
(
"modified_at",
models.DateTimeField(auto_now=True, verbose_name="Modified at"),
),
(
"name",
models.CharField(
db_comment="Name of the script tag",
help_text="Unique name of the script tag.",
max_length=100,
unique=True,
verbose_name="Name",
),
),
(
"content",
models.TextField(
db_comment="HTML/JavaScript content of the script tag",
help_text="The HTML/JavaScript content to be injected.",
verbose_name="Content",
),
),
(
"placement",
models.CharField(
choices=[
("head", "Head"),
("start_body", "Start of Body"),
("end_body", "End of Body"),
],
db_comment="Placement location in the HTML document",
default="head",
help_text="Location in the HTML document where the script will be injected.",
max_length=10,
verbose_name="Placement",
),
),
(
"is_active",
models.BooleanField(
db_comment="Active status of the script tag",
default=True,
help_text="Status to indicate whether the script is active or not.",
verbose_name="Active",
),
),
],
options={
"verbose_name": "Script Tag",
"verbose_name_plural": "Script Tags",
"db_table": "script_tag",
"ordering": ["created_at"],
},
),
migrations.CreateModel(
name="URLRedirect",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"created_at",
models.DateTimeField(auto_now_add=True, verbose_name="Created at"),
),
(
"modified_at",
models.DateTimeField(auto_now=True, verbose_name="Modified at"),
),
(
"old_url",
models.CharField(
help_text="The old URL that was replaced.",
max_length=255,
validators=[sage_seo.models.validators.validate_url_format],
verbose_name="Old URL",
),
),
(
"new_url",
models.CharField(
help_text="The new URL that replaced the old one.",
max_length=255,
validators=[sage_seo.models.validators.validate_url_format],
verbose_name="New URL",
),
),
(
"redirect_type",
models.CharField(
choices=[("primary", "primary"), ("temporary", "temporary")],
default="primary",
help_text="The HTTP status code used to redirect a user from one URL to another.",
max_length=20,
validators=[django.core.validators.MaxLengthValidator(20)],
verbose_name="Redirect Type",
),
),
],
options={
"verbose_name": "URL Redirect",
"verbose_name_plural": "URL Redirects",
},
),
migrations.CreateModel(
name="SlugSwap",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"old_slug",
models.SlugField(
allow_unicode=True,
editable=False,
help_text="Slug is a newspaper term. A short label for something containing only letters, numbers, underscores, or hyphens. They are generally used in URLs.",
max_length=255,
verbose_name="Old Slug",
),
),
(
"new_slug",
models.SlugField(
allow_unicode=True,
editable=False,
help_text="Slug is a newspaper term. A short label for something containing only letters, numbers, underscores, or hyphens. They are generally used in URLs.",
max_length=255,
verbose_name="New Slug",
),
),
(
"object_id",
models.PositiveIntegerField(help_text="ID of the related object."),
),
(
"redirect_type",
models.CharField(
choices=[("primary", "primary"), ("temporary", "temporary")],
default="primary",
help_text="refers to the HTTP status code that is used toredirect a user from one URL to another",
max_length=20,
validators=[django.core.validators.MaxLengthValidator(20)],
verbose_name="redirect type",
),
),
(
"content_type",
models.ForeignKey(
help_text="Content type of the related object.",
on_delete=django.db.models.deletion.CASCADE,
to="contenttypes.contenttype",
),
),
],
options={
"verbose_name": "Slug Swap",
"verbose_name_plural": "Slug Swaps",
},
),
]
Loading