Skip to content

Commit

Permalink
Move to mdx
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Rico <[email protected]>
  • Loading branch information
SferaDev committed Dec 4, 2024
1 parent d46bce8 commit 6c75469
Show file tree
Hide file tree
Showing 35 changed files with 416 additions and 391 deletions.
42 changes: 21 additions & 21 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{
"title": "Add Column",
"href": "/operations/add_column",
"file": "docs/operations/add_column.md"
"file": "docs/operations/add_column.mdx"
},
{
"title": "Alter Column",
Expand All @@ -35,64 +35,64 @@
{
"title": "Rename Column",
"href": "/operations/alter_column/rename_column",
"file": "docs/operations/alter_column/rename_column.md"
"file": "docs/operations/alter_column/rename_column.mdx"
},
{
"title": "Change Type",
"href": "/operations/alter_column/change_type",
"file": "docs/operations/alter_column/change_type.md"
"file": "docs/operations/alter_column/change_type.mdx"
},
{
"title": "Change Default",
"href": "/operations/alter_column/change_default",
"file": "docs/operations/alter_column/change_default.md"
"file": "docs/operations/alter_column/change_default.mdx"
},
{
"title": "Change Comment",
"href": "/operations/alter_column/change_comment",
"file": "docs/operations/alter_column/change_comment.md"
"file": "docs/operations/alter_column/change_comment.mdx"
},
{
"title": "Add Check Constraint",
"href": "/operations/alter_column/add_check_constraint",
"file": "docs/operations/alter_column/add_check_constraint.md"
"file": "docs/operations/alter_column/add_check_constraint.mdx"
},
{
"title": "Add Foreign Key",
"href": "/operations/alter_column/add_foreign_key",
"file": "docs/operations/alter_column/add_foreign_key.md"
"file": "docs/operations/alter_column/add_foreign_key.mdx"
},
{
"title": "Add Not Null Constraint",
"href": "/operations/alter_column/add_not_null_constraint",
"file": "docs/operations/alter_column/add_not_null_constraint.md"
"file": "docs/operations/alter_column/add_not_null_constraint.mdx"
},
{
"title": "Drop Not Null Constraint",
"href": "/operations/alter_column/drop_not_null_constraint",
"file": "docs/operations/alter_column/drop_not_null_constraint.md"
"file": "docs/operations/alter_column/drop_not_null_constraint.mdx"
},
{
"title": "Add Unique Constraint",
"href": "/operations/alter_column/add_unique_constraint",
"file": "docs/operations/alter_column/add_unique_constraint.md"
"file": "docs/operations/alter_column/add_unique_constraint.mdx"
}
]
},
{
"title": "Create Index",
"href": "/operations/create_index",
"file": "docs/operations/create_index.md"
"file": "docs/operations/create_index.mdx"
},
{
"title": "Create Table",
"href": "/operations/create_table",
"file": "docs/operations/create_table.md"
"file": "docs/operations/create_table.mdx"
},
{
"title": "Create Constraint",
"href": "/operations/create_constraint",
"file": "docs/operations/create_constraint.md"
"file": "docs/operations/create_constraint.mdx"
},
{
"title": "Drop Column",
Expand All @@ -102,42 +102,42 @@
{
"title": "Drop Constraint (deprecated)",
"href": "/operations/drop_constraint",
"file": "docs/operations/drop_constraint.md"
"file": "docs/operations/drop_constraint.mdx"
},
{
"title": "Drop Multi-Column Constraint",
"href": "/operations/drop_multi_column_constraint",
"file": "docs/operations/drop_multi_column_constraint.md"
"file": "docs/operations/drop_multi_column_constraint.mdx"
},
{
"title": "Drop Index",
"href": "/operations/drop_index",
"file": "docs/operations/drop_index.md"
"file": "docs/operations/drop_index.mdx"
},
{
"title": "Drop Table",
"href": "/operations/drop_table",
"file": "docs/operations/drop_table.md"
"file": "docs/operations/drop_table.mdx"
},
{
"title": "Raw SQL",
"href": "/operations/raw_sql",
"file": "docs/operations/raw_sql.md"
"file": "docs/operations/raw_sql.mdx"
},
{
"title": "Rename Table",
"href": "/operations/rename_table",
"file": "docs/operations/rename_table.md"
"file": "docs/operations/rename_table.mdx"
},
{
"title": "Rename Constraint",
"href": "/operations/rename_constraint",
"file": "docs/operations/rename_constraint.md"
"file": "docs/operations/rename_constraint.mdx"
},
{
"title": "Set Replica Identity",
"href": "/operations/set_replica_identity",
"file": "docs/operations/set_replica_identity.md"
"file": "docs/operations/set_replica_identity.mdx"
}
]
}
Expand Down
31 changes: 19 additions & 12 deletions docs/operations/add_column.md → docs/operations/add_column.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Add column
---
title: Add column
description: An add column operation creates a new column on an existing table.
---

## Structure

An add column operation creates a new column on an existing table.

**add column** operations have this structure:

```json
{
"add_column": {
Expand All @@ -26,7 +25,7 @@ An add column operation creates a new column on an existing table.
"references": {
"name": "name of foreign key constraint",
"table": "name of referenced table",
"column": "name of referenced column"
"column": "name of referenced column",
"on_delete": "ON DELETE behaviour, can be CASCADE, SET NULL, RESTRICT, or NO ACTION. Default is NO ACTION",
}
}
Expand All @@ -40,9 +39,17 @@ Default values are subject to the usual rules for quoting SQL expressions. In pa

## Examples

- [03_add_column.json](../../examples/03_add_column.json)
- [06_add_column_to_sql_table.json](../../examples/06_add_column_to_sql_table.json)
- [17_add_rating_column.json](../../examples/17_add_rating_column.json)
- [26_add_column_with_check_constraint.json](../../examples/26_add_column_with_check_constraint.json)
- [30_add_column_simple_up.json](../../examples/30_add_column_simple_up.json)
- [41_add_enum_column.json](../../examples/41_add_enum_column.json)
<ExampleSnippet example="03_add_column.json" language="json" />

<ExampleSnippet example="06_add_column_to_sql_table.json" language="json" />

<ExampleSnippet example="17_add_rating_column.json" language="json" />

<ExampleSnippet
example="26_add_column_with_check_constraint.json"
language="json"
/>

<ExampleSnippet example="30_add_column_simple_up.json" language="json" />

<ExampleSnippet example="41_add_enum_column.json" language="json" />
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Add check constraint
---
title: Add check constraint
description: An add check constraint operation adds a `CHECK` constraint to a column.
---

## Structure

An add check constraint operation adds a `CHECK` constraint to a column.

**add check constraint** migrations have this structure:

```json
{
"alter_column": {
Expand All @@ -23,4 +22,4 @@ An add check constraint operation adds a `CHECK` constraint to a column.

## Examples

- [22_add_check_constraint.json](../../../examples/22_add_check_constraint.json)
<ExampleSnippet example="22_add_check_constraint.json" language="json" />
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Add foreign key
---
title: Add foreign key
description: Add foreign key operations add a foreign key constraint to a column.
---

## Structure

Add foreign key operations add a foreign key constraint to a column.

**add foreign key** constraints have this structure:

```json
{
"alter_column": {
Expand All @@ -25,4 +24,4 @@ Add foreign key operations add a foreign key constraint to a column.

## Examples

- [21_add_foreign_key_constraint.json](../../../examples/21_add_foreign_key_constraint.json)
<ExampleSnippet example="21_add_foreign_key_constraint.json" language="json" />
23 changes: 0 additions & 23 deletions docs/operations/alter_column/add_not_null_constraint.md

This file was deleted.

22 changes: 22 additions & 0 deletions docs/operations/alter_column/add_not_null_constraint.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: Add not null constraint
description: Add not null operations add a `NOT NULL` constraint to a column.
---

## Structure

```json
{
"alter_column": {
"table": "table name",
"column": "column name",
"nullable": false,
"up": "SQL expression",
"down": "SQL expression"
}
}
```

## Examples

<ExampleSnippet example="16_set_nullable.json" language="json" />
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Add unique constraint
---
title: Add unique constraint
description: Add unique operations add a `UNIQUE` constraint to a column.
---

## Structure

Add unique operations add a `UNIQUE` constraint to a column.

**add unique** operations have this structure:

```json
{
"alter_column": {
Expand All @@ -22,4 +21,4 @@ Add unique operations add a `UNIQUE` constraint to a column.

## Examples

- [15_set_column_unique.json](../../../examples/15_set_column_unique.json)
<ExampleSnippet example="15_set_column_unique.json" language="json" />
24 changes: 0 additions & 24 deletions docs/operations/alter_column/change_comment.md

This file was deleted.

24 changes: 24 additions & 0 deletions docs/operations/alter_column/change_comment.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: Change comment
description: A change comment operation changes the comment on a column.
---

## Structure

```json
{
"alter_column": {
"table": "table name",
"column": "column name",
"comment": "new comment for column" | null,
"up": "SQL expression",
"down": "SQL expression"
}
}
```

## Examples

<ExampleSnippet example="35_alter_column_multiple.json" language="json" />

<ExampleSnippet example="36_set_comment_to_null.json" language="json" />
24 changes: 0 additions & 24 deletions docs/operations/alter_column/change_default.md

This file was deleted.

24 changes: 24 additions & 0 deletions docs/operations/alter_column/change_default.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: Change default
description: A change default operation changes the default value of a column.
---

## Structure

```json
{
"alter_column": {
"table": "table name",
"column": "column name",
"default": "new default value" | null,
"up": "SQL expression",
"down": "SQL expression"
}
}
```

## Examples

<ExampleSnippet example="35_alter_column_multiple.json" language="json" />

<ExampleSnippet example="46_alter_column_drop_default.json" language="json" />
Loading

0 comments on commit 6c75469

Please sign in to comment.