Bytebase provides customizable SQL lint rules to check common issues in database change and query process.Different sets of rules can form different SQL Review Policies for the respective environment.
InnoDB is the default storage engine of MySQL 5.5+. It provides powerful transaction features. Normally, using InnoDB as the storage engine is the only option. Bytebase provides this rule to catch all scenarios where other engines are attempted.
Using fully qualified object names in SQL ensures clarity and precision. It helps the database system to quickly locate and distinguish between objects, even if they have the same name but exist in different schemas or databases. This practice can improve performance by reducing ambiguity and aiding in the efficient execution of queries.
Bytebase checks whether the object name appearing in the SQL statement is fully qualified. The exception is that bytebase does not check pseudo table names in common table expressions (CTE), such as foo in WITH foo AS (SELECT * FROM public.pokes) SELECT * FROM foo.
The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the table naming convention.
Table Naming Convention uses regular expression as the format for naming pattern, and also limits the naming max length. The default maximum length is 64 characters. Length limit does not support PostgreSQL.
The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the column naming convention.
Column Naming Convention uses regular expression format for naming pattern, and also limits the naming max length. The default maximum length is 64 characters. Length limit does not support PostgreSQL.
The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the auto-increment column naming convention.
Auto-increment Column Naming Convention uses regular expression format for naming pattern, and also limits the naming maximum length. The default maximum length is 64 characters.
The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the index naming convention.
Index Naming Convention uses template format. Specifically, the template is an extended regular expression. The rest follows the regular expression rules except the part with curly braces.For example, ^idx_{{table}}_{{column_list}}$ is a template where {{table}} is the table name and {{column_list}} is the list of the column name. So for index on user(id, name), the legal name is idx_user_id_name.It also limits the naming max length. The default maximum length is 64 characters. Length limit does not support PostgreSQL.
Bytebase checks that all index names in DDL conform to the naming conventions.
Index Naming Convention rule is only valid for index, which means it does NOT work for unique key, foreign key and primary key.
Also see primary key naming, unique key naming convention and foreign key naming convention.
The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the primary key naming convention.
This rule does NOT support MySQL and TiDB. Because the name of a PRIMARY KEY is always PRIMARY in MySQL and TiDB.
Primary Key Naming Convention uses template format. Specifically, the template is an extended regular expression. The rest follows the regular expression rules except the part with curly braces.For example, ^pk_{{table}}_{{column_list}}$ is a template where {{table}} is the table name and {{column_list}} is the list of the column name. So for primary key on user(id, name), the legal name is pk_user_id_name.
Bytebase checks that all index names in DDL conform to the naming conventions.
Primary Key Naming Convention rule is only valid for primary key, which means it does NOT work for unique key, foreign key and normal index.
Also see index naming convention, unique key naming convention and foreign key naming convention.
The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the unique key naming convention.
Unique Key Naming Convention uses template format. Specifically, the template is an extended regular expression. The rest follows the regular expression rules except the part with curly braces.For example, ^uk_{{table}}_{{column_list}}$ is a template where {{table}} is the table name and {{column_list}} is the list of the column name. So for unique key on user(id, name), the legal name is uk_user_id_name.It also limits the naming max length. The default maximum length is 64 characters. Length limit does not support PostgreSQL.
Bytebase checks that all unique key names in DDL conform to the naming conventions.
Unique Key Naming Convention rule is only valid for unique key, which means it does NOT work for index, foreign key and primary key.
Also see index naming convention, primary key naming convention and foreign key naming convention.
The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the foreign key naming convention.
Foreign Key Naming Convention uses template format. Specifically, the template is an extended regular expression. The rest follows the regular expression rules except the part with curly braces.For example, ^fk_{{referencing_table}}_{{referencing_column}}_{{referenced_table}}_{{referenced_column}}$ is a template where {{referencing_table}} is the name of the referencing table, {{referencing_column}} is the list of the referencing column name, {{referenced_table}} is the name of the referenced table and {{referenced_column}} is the list of the referencing column name. So for unique key on user(id, name), the legal name is uk_user_id_name.It also limits the naming max length. The default maximum length is 64 characters. Length limit does not support PostgreSQL.
Bytebase checks that all foreign key names in DDL conform to the naming conventions.
Foreign Key Naming Convention rule is only valid for foreign key, which means it does NOT work for index, unique key and primary key.
Also see index naming convention, primary key naming convention and unique key naming convention.
Using keywords as table names in Oracle, or any other database management system, is generally not recommended for several reasons:
Reserved Keywords: Database systems have a set of reserved keywords that are used for defining the structure and operations of the database. These keywords have specific meanings and functionalities within the system. If you use a reserved keyword as a table name, it can lead to conflicts and ambiguity when executing queries or performing operations on the table.
Query Conflicts: When you use a reserved keyword as a table name, it can cause conflicts and confusion when constructing SQL queries. The database may interpret the keyword as a command or function instead of a table name, resulting in unexpected behavior or errors. It becomes necessary to use special techniques or syntax to differentiate the table name from the keyword, which can make the queries more complex and error-prone.
Code Readability: Using keywords as table names can make the code less readable and maintainable. Table names are meant to represent the entities or concepts they represent in the system. Choosing descriptive and meaningful names for tables improves code clarity and understanding. When keywords are used, it can be challenging for developers, administrators, or future maintainers to grasp the purpose and usage of the tables quickly.
Portability: If you decide to migrate your database from one DBMS to another in the future, using keywords as table names can cause compatibility issues. Different database systems have different sets of reserved keywords, and these keywords may vary in meaning and functionality. Migrating a database containing table names that are keywords in the target DBMS may require modifying the table names or using workarounds, which can be time-consuming and error-prone.
Bytebase provides this rule to unify the identifier case.For Oracle, if the identifier is not quoted, it is converted to uppercase. In order to unify the identifier case, you can use this rule to disallow the lowercase identifier.
SELECT * introduces additional performance cost or ambiguous semantics.For scenarios where all columns are not required, you should SELECT the columns you need to avoid getting unneeded data.For scenarios where all columns are required, you should list all column names to avoid semantic ambiguity. Otherwise, the data consumer cannot know the column information. And SELECT * may bring additional modifications and errors when modifying the table schema.
There are countless stories about people forgetting the WHERE clause in an UPDATE or DELETE and losing data. In queries, not using WHERE can also cause performance issues.If you are sure you need to act on all data, use WHERE 1=1 to remind yourself of the consequences of that action.
Database cannot use an index to match entries when there is a leading wildcard. It can cause serious performance problems because it may scan the entire table.
The PostgreSQL will lock the table and rewrite the whole table when you adding column with default value. You can separate the adding column, setting default value and backfilling all existing rows.
Adding CHECK constraints without NOT VALID can cause downtime because it blocks reads and writes. You can manually verify all rows and validate the constraint after creating.
Limit DDL operations on tables with large data volumes
DDL operations on large tables can cause long locks because they need exclusive access to update the table’s structure and metadata, which takes more time for bigger tables.
In almost all cases, each table needs a primary key.e.g. in MySQL, the InnoDB storage engine always creates a primary key if you didn’t specify it explicitly or didn’t create a unique key, thus making an extra column you don’t have access to.
Bytebase considers this rule to be violated if the SQL tries to create a no primary key table or drop the primary key. If the SQL drops all columns in the primary key, Bytebase also considers that this SQL drops the primary key.
This rule disallows users to create foreign key in the table.A foreign key is a logical association of rows between two tables, in a parent-child relationship. A row in a “parent” table may be referenced by one or more rows in a “child” table.FOREIGN KEY constraints are impossible to maintain once your data grows and is split over multiple database servers. This typically happens when you introduce functional partitioning/sharding and/or horizontal sharding.
Only tables named with specific naming patterns can be deleted. This requires users to do a rename and then drop the table.The naming convention uses regular expression format. By default the table name must have _del suffix.
Introducing backward incompatible schema changes is one of the most common mistakes made by developers. And enforcing backward compatible schema change is the standard practice adopted by many engineering organizations. Bytebase provides the built-in backward compatible check to catch all common incompatible schema change scenarios.
For most projects, you may want to enforce some columns for every table. For example, need id as identification and the primary key for each table or need created_ts and updated_ts to record creation and modification times.You can customize which columns are required.
Bytebase defaults all tables to meet the requirements. If the SQL tries to define a table not having all the required columns or attempts to drop the required column, Bytebase considers this rule to be violated.
Changing column type may fail because the data cannot be converted. Bytebase provides this rule to alert you that the SQL statement would change the column type.
CHANGE COLUMN is a MySQL extension to standard SQL. CHANGE COLUMN can change column definition and names, or both.
Most of the time, you just want to change one of two. So you need to use RENAME COLUMN and MODIFY COLUMN instead of CHANGE COLUMN to avoid unexpected modifications.
This rule will count the two types of the columns:
the column with default current time , such as DEFAULT NOW()
the column with ON UPDATE current time, such as ON UPDATE NOW()
If the count of type one columns is more than two or the count of type two columns is more than one, this rule will alert users.The meaning of the number is:
A table usually has created_ts and updated_ts column with DEFAULT NOW().
A table usually has updated_ts column with ON UPDATE NOW()
Disallow setting volatile default value on columns
Volatile functions, such as clock_timestamp(), update each row with the value at the time of ALTER TABLE ADD COLUMN execution. This can lead to lengthy updates and potential performance issues.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Bytebase Docs","colors":{"primary":"#2b66ff","light":"#4faaff","dark":"#1c49be"},"logo":{"light":"https://mintcdn.com/dbx/vw8BbfZhlW9y-cr_/images/logo/logo-full.png?fit=max\u0026auto=format\u0026n=vw8BbfZhlW9y-cr_\u0026q=85\u0026s=894c5021793b82b6bcef8b09cef3d85d","dark":"https://mintcdn.com/dbx/vw8BbfZhlW9y-cr_/images/logo/logo-full-white.png?fit=max\u0026auto=format\u0026n=vw8BbfZhlW9y-cr_\u0026q=85\u0026s=9f660755d7e64c8f3d4882e66589af29"},"favicon":"https://mintcdn.com/dbx/otHCKEZkOwO4gA2D/favicon.svg?fit=max\u0026auto=format\u0026n=otHCKEZkOwO4gA2D\u0026q=85\u0026s=a7e205f761697f5ffcec570fa5de78b0","navbar":{"links":[{"href":"https://www.bytebase.com","label":"bytebase.com"}],"primary":{"type":"button","label":"Try Cloud","href":"https://cloud.bytebase.com/"}},"footer":{"socials":{"x":"https://x.com/bytebase","github":"https://github.com/bytebase/bytebase","linkedin":"https://linkedin.com/company/bytebase"}},"seo":{"metatags":{"canonical":"https://docs.bytebase.com"}},"icons":{"library":"lucide"},"integrations":{"ga4":{"measurementId":"G-4BZ4JH7449"}},"errors":{"404":{"redirect":false}},"contextual":{"options":["copy","view","chatgpt","claude"],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"dbx","hasAudioNarration":false,"actualSubdomain":"dbx","customDomains":["docs.bytebase.com"],"gitSource":{"type":"github","owner":"bytebase","repo":"bytebase.com","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aec9494ca078695d82aa0bf","clientVersion":"0.0.4087","searchFilterCounts":[{"language":"default","tag":"Changelog","count":54},{"language":"default","tag":"Change Management","count":46},{"language":"default","tag":"Get Started","count":43},{"language":"default","tag":"Tutorials","count":41},{"language":"default","tag":"Administration","count":32},{"language":"default","tag":"GitOps Workflow","count":24},{"language":"default","tag":"Access Control","count":23},{"language":"default","tag":"Security","count":19},{"language":"default","tag":"UI-Driven Workflow","count":15},{"language":"default","tag":"Install","count":11}]},"assistantConfig":{"enableAskAiButton":true,"enableAskAiSearchBar":false,"deflection":{"enabled":true,"email":"help@bytebase.com"}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"comment-mode","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"demo-embed.css","content":".demo-embed{position:relative;display:block;margin:1.5rem 0;border:0;border-radius:0;cursor:zoom-in;text-decoration:none!important}.demo-embed img{display:block;width:100%;margin:0!important;border-radius:0!important}.demo-embed::after{content:\"Play the interactive demo\";position:absolute;left:50%;top:50%;transform:translate(-50%, -50%);padding:0.5rem 0.875rem 0.5rem 2.25rem;border:1px solid rgb(228 228 231);border-radius:9999px;background:rgb(255 255 255 / 0.96) no-repeat 0.875rem center / 1rem 1rem\n\t\turl(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2318181b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3H5a2 2 0 0 0-2 2v3M21 8V5a2 2 0 0 0-2-2h-3M3 16v3a2 2 0 0 0 2 2h3M16 21h3a2 2 0 0 0 2-2v-3'/%3E%3C/svg%3E\");color:rgb(24 24 27);font-size:0.8125rem;font-weight:500;line-height:1.25rem;box-shadow:0 2px 8px rgb(0 0 0 / 0.12);transition:transform 0.15s ease}.demo-embed:hover::after{transform:translate(-50%, -50%) scale(1.04)}.demo-dialog{position:fixed;inset:0;margin:auto;width:min(96vw, calc((100vh - 5rem) * 792 / 480), 1352px);max-width:none;max-height:none;padding:0;border:0;background:transparent;box-shadow:none;overflow:visible}.demo-dialog::backdrop{background:rgb(255 255 255 / 0.85);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px)}html.dark .demo-dialog::backdrop{background:rgb(9 9 11 / 0.85)}.demo-dialog iframe{display:block;width:100%;aspect-ratio:792 / 480;border:0}.demo-dialog__close{position:fixed;top:1rem;right:1rem;display:flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;border:1px solid rgb(228 228 231);border-radius:9999px;background:#fff;color:rgb(24 24 27);font-size:1.25rem;line-height:1;cursor:pointer}html.dark .demo-dialog__close{border-color:rgb(63 63 70);background:rgb(24 24 27);color:#fff}"}],"page":{"pagePath":"sql-review/review-rules","slug":"/sql-review/review-rules","pageMetadata":{"title":"Review Rules","description":null,"href":"/sql-review/review-rules"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,h5:`h5`,li:`li`,ol:`ol`,p:`p`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Heading,Note,OptimizedImage,Table}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Bytebase provides customizable SQL lint rules to check common issues in database change and query process.`}),`\n`,_jsxs(_components.p,{children:[`Different sets of rules can form different `,_jsx(_components.a,{href:`/sql-review/review-policy`,children:`SQL Review Policies`}),` for the respective environment.`]}),`\n`,_jsx(Heading,{level:`2`,id:`supported-rules`,children:`Supported rules`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Engine`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#engine.mysql.use-innodb`,children:`Require InnoDB`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Naming`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#naming.fully-qualified`,children:`Fully qualified object name`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#naming.table`,children:`Table naming convention`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#naming.column`,children:`Column naming convention`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#naming.column.auto-increment`,children:`Auto-increment column naming convention`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#naming.index.idx`,children:`Index naming convention`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#naming.index.pk`,children:`Primary key naming convention`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#naming.index.uk`,children:`Unique key naming convention`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#naming.index.fk`,children:`Foreign key naming convention`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Statement`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.select.no-select-all`,children:`Disallow SELECT *`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.where.require`,children:`Require WHERE`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.where.no-leading-wildcard-like`,children:`Disallow leading % in LIKE`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.disallow-commit`,children:`Disallow COMMIT`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.disallow-limit`,children:`Disallow LIMIT`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.disallow-order-by`,children:`Disallow ORDER BY`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.merge-alter-table`,children:`Merge ALTER TABLE`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.insert.must-specify-column`,children:`INSERT statements must specify columns`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.insert.disallow-order-by-rand`,children:`Disallow ORDER BY RAND in INSERT statements`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.insert.row-limit`,children:`Limit the inserted rows`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.affected-row-limit`,children:`Limit affected rows`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.dml-dry-run`,children:`Dry run DML statements`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.disallow-add-column-with-default`,children:`Disallow add column with default`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.add-check-not-valid`,children:`Add CHECK constraints with NOT VALID option`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#statement.disallow-add-not-null`,children:`Disallow add NOT NULL constraints to an existing column`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Table`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#table.limit-size`,children:`Limit DDL operations on tables with large data volumes`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#table.require-pk`,children:`Require primary key`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#table.no-foreign-key`,children:`Disallow foreign key`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#table.drop-naming-convention`,children:`Drop naming convention`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#table.disallow-partition`,children:`Disallow partition table`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#table.comment`,children:`Table comment convention`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Schema`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#schema.backward-compatibility`,children:`Backward incompatible schema change`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Column`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.required`,children:`Enforce the required columns in each table`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.type-disallow-list`,children:`Column type disallow list`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.no-null`,children:`Columns no NULL value`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.disallow-change-type`,children:`Disallow changing column type`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.set-default-for-not-null`,children:`Set DEFAULT value for NOT NULL columns`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.disallow-change`,children:`Disallow ALTER TABLE CHANGE COLUMN statements`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.disallow-changing-order`,children:`Disallow changing column order`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.auto-increment-must-integer`,children:`Use integer for auto-increment columns`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.disallow-set-charset`,children:`Disallow set charset for columns`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.auto-increment-must-unsigned`,children:`Set unsigned attribute on auto-increment columns`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.comment`,children:`Column comment convention`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.maximum-character-length`,children:`Maximum CHAR length`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.auto-increment-initial-value`,children:`Auto-increment initial value`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.current-time-count-limit`,children:`Limit the count of current time columns`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.require-default`,children:`Require column default value`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#column.disallow-drop-in-index`,children:`Prohibit dropping columns in indexes`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Index`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#index.no-duplicate-column`,children:`Disallow duplicate column in index keys`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#index.key-number-limit`,children:`Limit the count of index keys`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#index.pk-type-limit`,children:`Limit key type for primary keys`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#index.type-no-blob`,children:`Disallow BLOB and TEXT for index keys`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#index.total-number-limit`,children:`Index count limit`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#index.primary-key-type-allowlist`,children:`Primary key type allowlist`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#index.create-concurrently`,children:`Create index concurrently`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Database`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#database.drop-empty-database`,children:`Drop database restriction`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`System`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#system.charset.allowlist`,children:`Charset allow list`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#system.collation.allowlist`,children:`Collation allow list`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#system.comment.length`,children:`Comment length limit`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`Built-in Rules`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#builtin.prior-backup-check`,children:`Prior backup feasibility check`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/sql-review/review-rules#builtin.statement.maximum-sql-size`,children:`Restrict the SQL file size`})}),`\n`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`engine`,children:`Engine`}),`\n`,_jsx(`div`,{id:`engine.mysql.use-innodb`}),`\n`,_jsx(Heading,{level:`3`,id:`require-innodb`,children:`Require InnoDB`}),`\n`,_jsx(_components.p,{children:`InnoDB is the default storage engine of MySQL 5.5+. It provides powerful transaction features. Normally, using InnoDB as the storage engine is the only option. Bytebase provides this rule to catch all scenarios where other engines are attempted.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-engine-mysql-use-innodb.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=bfcc38702589d234fd38ccc0c13e15bb`,alt:`schema-review-engine-mysql-use-innodb`,\"data-og-width\":`959`,width:`959`,\"data-og-height\":`361`,height:`361`,\"data-path\":`content/docs/sql-review/schema-review-engine-mysql-use-innodb.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-engine-mysql-use-innodb.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=489111431065931a133fb3c987d12fe8 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-engine-mysql-use-innodb.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=6fd8c8e811ffd95cc0d735ae472c432b 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-engine-mysql-use-innodb.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=0473848ac89da426930ed5009cfeba76 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-engine-mysql-use-innodb.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=4d1aabdaa6da162072a9ffbe44d0b615 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-engine-mysql-use-innodb.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=2fdef51b4896425427db18d8b01e7150 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-engine-mysql-use-innodb.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=4ca5d206722b3cb833dbfc68855c9239 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase defaults MySQL to use InnoDB storage engine.`}),`\n`,_jsx(_components.p,{children:`So if the following situation occurs, Bytebase considers this rule to be violated:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Explicitly specify other storage engines when creating tables. e.g. `,_jsx(_components.code,{children:`CREATE TABLE t(id int) ENGINE = CSV`})]}),`\n`,_jsxs(_components.li,{children:[`Explicitly specify other storage engines when `,_jsx(_components.code,{children:`ALTER TABLE`}),`. e.g. `,_jsx(_components.code,{children:`ALTER TABLE t ENGINE = CSV`})]}),`\n`,_jsxs(_components.li,{children:[`Try to set `,_jsx(_components.code,{children:`default_storage_engine`}),` other than InnoDB. e.g. `,_jsx(_components.code,{children:`SET default_storage_engine = CSV`})]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`naming`,children:`Naming`}),`\n`,_jsx(`div`,{id:`naming.fully-qualified`}),`\n`,_jsx(Heading,{level:`3`,id:`fully-qualified-object-name`,children:`Fully qualified object name`}),`\n`,_jsx(_components.p,{children:`Using fully qualified object names in SQL ensures clarity and precision. It helps the database system to quickly locate and distinguish between objects, even if they have the same name but exist in different schemas or databases. This practice can improve performance by reducing ambiguity and aiding in the efficient execution of queries.`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-2`,children:`How the rule works`}),`\n`,_jsxs(_components.p,{children:[`Bytebase checks whether the object name appearing in the SQL statement is fully qualified. The exception is that bytebase does not check pseudo table names in common table expressions (CTE), such as `,_jsx(_components.code,{children:`foo`}),` in `,_jsx(_components.code,{children:`WITH foo AS (SELECT * FROM public.pokes) SELECT * FROM foo`}),`.`]}),`\n`,_jsx(_components.h5,{children:`Some typical format`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Object Name`}),_jsx(_components.th,{children:`Fully qualified`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`table_name`}),_jsx(_components.td,{children:`no`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`schema_name.table_name`}),_jsx(_components.td,{children:`yes`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`database_name.schema_name.table_name`}),_jsx(_components.td,{children:`yes`})]})]})]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-2`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`]}),`\n`,_jsx(`div`,{id:`naming.table`}),`\n`,_jsx(Heading,{level:`3`,id:`table-naming-convention`,children:`Table naming convention`}),`\n`,_jsx(_components.p,{children:`The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the table naming convention.`}),`\n`,_jsx(Heading,{level:`4`,id:`about-convention-format`,children:`About convention format`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Table Naming Convention`}),` uses `,_jsx(_components.a,{href:`https://en.wikipedia.org/wiki/Regular_expression`,children:`regular expression`}),` as the format for naming pattern, and also limits the naming max length. The default maximum length is 64 characters. Length limit does not support PostgreSQL.`]}),`\n`,_jsx(_components.h5,{children:`Some typical format`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Regular Expression`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`snake_lower_case`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`^[a-z]+(_[a-z]+)*$`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`CamelCase`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`^([A-Z][a-z]*)+$`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`lowerCamelCase`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`^[a-z]+([A-Z][a-z]*)*$`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`kebab-case`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`^[a-z]+(-[a-z]+)*$`})})]})]})]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-table.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=5c900201ffce1f6e6863576ef295be6d`,alt:`schema-review-naming-table`,\"data-og-width\":`1922`,width:`1922`,\"data-og-height\":`978`,height:`978`,\"data-path\":`content/docs/sql-review/schema-review-naming-table.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-table.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=0442f4b0aee97853c5091f6071c940b5 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-table.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=bca377d23495af1b362fbe4c439918d5 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-table.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=cf1e9e7a618136c59f5654804fddab3d 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-table.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=51611f8eb59c838de59c24adb4688682 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-table.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=23eb96bb171c2f23daa62a1070dc6d52 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-table.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=e584265970a431f86ded19384efa3f76 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-3`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks that all table names in DDL conform to the naming conventions.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE RENAME TO`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`RENAME TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-3`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`,_jsx(_components.li,{children:`Snowflake`}),`\n`]}),`\n`,_jsx(`div`,{id:`naming.column`}),`\n`,_jsx(Heading,{level:`3`,id:`column-naming-convention`,children:`Column naming convention`}),`\n`,_jsx(_components.p,{children:`The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the column naming convention.`}),`\n`,_jsx(Heading,{level:`4`,id:`about-convention-format-2`,children:`About convention format`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Column Naming Convention`}),` uses `,_jsx(_components.a,{href:`https://en.wikipedia.org/wiki/Regular_expression`,children:`regular expression`}),` format for naming pattern, and also limits the naming max length. The default maximum length is 64 characters. Length limit does not support PostgreSQL.`]}),`\n`,_jsx(_components.h5,{children:`Some typical format`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Regular Expression`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`snake_lower_case`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`^[a-z]+(_[a-z]+)*$`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`CamelCase`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`^([A-Z][a-z]*)+$`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`lowerCamelCase`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`^[a-z]+([A-Z][a-z]*)*$`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`kebab-case`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`^[a-z]+(-[a-z]+)*$`})})]})]})]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-column.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=7b8b2f9ed7c27dbba7078e8dc1779dfe`,alt:`schema-review-naming-column`,\"data-og-width\":`967`,width:`967`,\"data-og-height\":`372`,height:`372`,\"data-path\":`content/docs/sql-review/schema-review-naming-column.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-column.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=64223efcb5937f5ae953c40f2123d7bc 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-column.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=cbfadfb37eea883604d45b859a6c76cc 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-column.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=b2a37360ad3f06b1d214c43ef6178ed7 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-column.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=b78ac50c3f30a596dc81641b2df3d3ce 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-column.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=4e67a88bd906b74a0bad2784b6d9a1dd 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-column.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=4b3cde9ba50d91c09deda4021e5282f9 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-4`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks that all column names in DDL conform to the naming conventions.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE RENAME COLUMN`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE ADD COLUMNS`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE CHANGE COLUMN`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-4`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`naming.column.auto-increment`}),`\n`,_jsx(Heading,{level:`3`,id:`auto-increment-column-naming-convention`,children:`Auto-increment column naming convention`}),`\n`,_jsx(_components.p,{children:`The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the auto-increment column naming convention.`}),`\n`,_jsx(Heading,{level:`4`,id:`about-convention-format-3`,children:`About convention format`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Auto-increment Column Naming Convention`}),` uses `,_jsx(_components.a,{href:`https://en.wikipedia.org/wiki/Regular_expression`,children:`regular expression`}),` format for naming pattern, and also limits the naming maximum length. The default maximum length is 64 characters.`]}),`\n`,_jsx(_components.h5,{children:`Some typical format`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Regular Expression`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`id`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`^id$`})})]})})]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-reivew-naming-auto-increment.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=99583429b3ded735766f0c1891707866`,alt:`sql-review-naming-auto-increment`,\"data-og-width\":`931`,width:`931`,\"data-og-height\":`357`,height:`357`,\"data-path\":`content/docs/sql-review/sql-reivew-naming-auto-increment.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-reivew-naming-auto-increment.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=6c54bc74b8ff0f0296085a23075d72fc 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-reivew-naming-auto-increment.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=4367509686241f3423a17c5f90018fda 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-reivew-naming-auto-increment.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=cbd2a2d3cbef48e71110ff07fc96585c 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-reivew-naming-auto-increment.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=53b4aa74c1a3fedc49e75c3660a0cbbe 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-reivew-naming-auto-increment.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=e6462ca3072f4a36ef737cf039f561b3 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-reivew-naming-auto-increment.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=15d0de36f3673c38edacd282af28178d 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-5`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks all auto-increment column names in DDL conforming to the naming conventions.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-5`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`naming.index.idx`}),`\n`,_jsx(Heading,{level:`3`,id:`index-naming-convention`,children:`Index naming convention`}),`\n`,_jsx(_components.p,{children:`The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the index naming convention.`}),`\n`,_jsx(Heading,{level:`4`,id:`about-convention-format-4`,children:`About convention format`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Index Naming Convention`}),` uses `,_jsx(_components.code,{children:`template`}),` format. Specifically, the `,_jsx(_components.code,{children:`template`}),` is an extended `,_jsx(_components.a,{href:`https://en.wikipedia.org/wiki/Regular_expression`,children:`regular expression`}),`. The rest follows the regular expression rules except the part with curly braces.`]}),`\n`,_jsxs(_components.p,{children:[`For example, `,_jsx(_components.code,{children:`^idx_{{table}}_{{column_list}}$`}),` is a `,_jsx(_components.code,{children:`template`}),` where `,_jsx(_components.code,{children:`{{table}}`}),` is the table name and `,_jsx(_components.code,{children:`{{column_list}}`}),` is the list of the column name. So for index on `,_jsx(_components.code,{children:`user(id, name)`}),`, the legal name is `,_jsx(_components.code,{children:`idx_user_id_name`}),`.`]}),`\n`,_jsx(_components.p,{children:`It also limits the naming max length. The default maximum length is 64 characters. Length limit does not support PostgreSQL.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-idx.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=f0e68ed535eff5fc0e2017e317bc8655`,alt:`schema-review-naming-index-idx`,\"data-og-width\":`928`,width:`928`,\"data-og-height\":`369`,height:`369`,\"data-path\":`content/docs/sql-review/schema-review-naming-index-idx.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-idx.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=eb3c4bf91edabce7a3757a3efd80ee42 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-idx.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=2a5acec7140d45dcfb1830555096ea48 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-idx.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=4c853de269e5161dbbf3df76f36b062d 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-idx.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=d507a4af03af8f9d42478e1164a19b25 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-idx.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=5b56d3f7c52b230b257225c8905aeefd 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-idx.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=8def4c6d1c81200889aa78a304549154 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-6`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks that all index names in DDL conform to the naming conventions.`}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Index Naming Convention`}),` rule is only valid for index, which means it does `,_jsx(_components.strong,{children:`NOT`}),` work for unique key, foreign key and primary key.\nAlso see primary key naming, unique key naming convention and foreign key naming convention.`]})}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE RENAME INDEX`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE ADD CONSTRAINT`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE INDEX`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-6`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`naming.index.pk`}),`\n`,_jsx(Heading,{level:`3`,id:`primary-key-naming-convention`,children:`Primary key naming convention`}),`\n`,_jsxs(_components.p,{children:[`The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the primary key naming convention.\nThis rule does `,_jsx(_components.strong,{children:`NOT`}),` support MySQL and TiDB. Because the name of a PRIMARY KEY is always PRIMARY in MySQL and TiDB.`]}),`\n`,_jsx(Heading,{level:`4`,id:`about-convention-format-5`,children:`About convention format`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Primary Key Naming Convention`}),` uses `,_jsx(_components.code,{children:`template`}),` format. Specifically, the `,_jsx(_components.code,{children:`template`}),` is an extended `,_jsx(_components.a,{href:`https://en.wikipedia.org/wiki/Regular_expression`,children:`regular expression`}),`. The rest follows the regular expression rules except the part with curly braces.`]}),`\n`,_jsxs(_components.p,{children:[`For example, `,_jsx(_components.code,{children:`^pk_{{table}}_{{column_list}}$`}),` is a `,_jsx(_components.code,{children:`template`}),` where `,_jsx(_components.code,{children:`{{table}}`}),` is the table name and `,_jsx(_components.code,{children:`{{column_list}}`}),` is the list of the column name. So for primary key on `,_jsx(_components.code,{children:`user(id, name)`}),`, the legal name is `,_jsx(_components.code,{children:`pk_user_id_name`}),`.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-pk.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=6e5c22c31be39df427c90a37166cfdd9`,alt:`schema-review-naming-index-pk`,\"data-og-width\":`1366`,width:`1366`,\"data-og-height\":`520`,height:`520`,\"data-path\":`content/docs/sql-review/schema-review-naming-index-pk.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-pk.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=11eb758ef9ade1fad8a046b17edaf19e 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-pk.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=c01b61142d0b8aab3f1d83333070ce76 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-pk.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=0ae8648ffc3a1411718b690f1e742cee 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-pk.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=8d620f923fde799190fb4c338bd992d7 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-pk.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=16a0a96a9e0c755b1a5e68e45fe04a25 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-pk.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=c05274706124aff8497e85f5f755ffb7 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-7`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks that all index names in DDL conform to the naming conventions.`}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Primary Key Naming Convention`}),` rule is only valid for primary key, which means it does `,_jsx(_components.strong,{children:`NOT`}),` work for unique key, foreign key and normal index.\nAlso see index naming convention, unique key naming convention and foreign key naming convention.`]})}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER INDEX RENAME TO`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE ADD CONSTRAINT`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-7`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`]}),`\n`,_jsx(`div`,{id:`naming.index.uk`}),`\n`,_jsx(Heading,{level:`3`,id:`unique-key-naming-convention`,children:`Unique key naming convention`}),`\n`,_jsx(_components.p,{children:`The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the unique key naming convention.`}),`\n`,_jsx(Heading,{level:`4`,id:`about-convention-format-6`,children:`About convention format`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Unique Key Naming Convention`}),` uses `,_jsx(_components.code,{children:`template`}),` format. Specifically, the `,_jsx(_components.code,{children:`template`}),` is an extended `,_jsx(_components.a,{href:`https://en.wikipedia.org/wiki/Regular_expression`,children:`regular expression`}),`. The rest follows the regular expression rules except the part with curly braces.`]}),`\n`,_jsxs(_components.p,{children:[`For example, `,_jsx(_components.code,{children:`^uk_{{table}}_{{column_list}}$`}),` is a `,_jsx(_components.code,{children:`template`}),` where `,_jsx(_components.code,{children:`{{table}}`}),` is the table name and `,_jsx(_components.code,{children:`{{column_list}}`}),` is the list of the column name. So for unique key on `,_jsx(_components.code,{children:`user(id, name)`}),`, the legal name is `,_jsx(_components.code,{children:`uk_user_id_name`}),`.`]}),`\n`,_jsx(_components.p,{children:`It also limits the naming max length. The default maximum length is 64 characters. Length limit does not support PostgreSQL.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-uk.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=4a07e4edec086a8dfd5f1f80544367c4`,alt:`schema-review-naming-index-uk`,\"data-og-width\":`941`,width:`941`,\"data-og-height\":`359`,height:`359`,\"data-path\":`content/docs/sql-review/schema-review-naming-index-uk.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-uk.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=e54422a948b3fec9f7f05676c3687207 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-uk.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=497d3e2d31d583c431c394e7692584b1 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-uk.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=7d02ae856c149246cc7089ada627b3c5 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-uk.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=85d8014937c0fde973df998345e79244 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-uk.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=086c556d997b9681fba57cab021ec245 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-uk.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=66ea17f5058fb4473672a0b5042a59db 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-8`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks that all unique key names in DDL conform to the naming conventions.`}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Unique Key Naming Convention`}),` rule is only valid for unique key, which means it does `,_jsx(_components.strong,{children:`NOT`}),` work for index, foreign key and primary key.\nAlso see index naming convention, primary key naming convention and foreign key naming convention.`]})}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE RENAME INDEX`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE ADD CONSTRAINT`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE INDEX`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-8`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`naming.index.fk`}),`\n`,_jsx(Heading,{level:`3`,id:`foreign-key-naming-convention`,children:`Foreign key naming convention`}),`\n`,_jsx(_components.p,{children:`The unified naming convention is desired by developers. And the same applies to the database space. Bytebase provides this rule to unify the foreign key naming convention.`}),`\n`,_jsx(Heading,{level:`4`,id:`about-convention-format-7`,children:`About convention format`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Foreign Key Naming Convention`}),` uses `,_jsx(_components.code,{children:`template`}),` format. Specifically, the `,_jsx(_components.code,{children:`template`}),` is an extended `,_jsx(_components.a,{href:`https://en.wikipedia.org/wiki/Regular_expression`,children:`regular expression`}),`. The rest follows the regular expression rules except the part with curly braces.`]}),`\n`,_jsxs(_components.p,{children:[`For example, `,_jsx(_components.code,{children:`^fk_{{referencing_table}}_{{referencing_column}}_{{referenced_table}}_{{referenced_column}}$`}),` is a `,_jsx(_components.code,{children:`template`}),` where `,_jsx(_components.code,{children:`{{referencing_table}}`}),` is the name of the referencing table, `,_jsx(_components.code,{children:`{{referencing_column}}`}),` is the list of the referencing column name, `,_jsx(_components.code,{children:`{{referenced_table}}`}),` is the name of the referenced table and `,_jsx(_components.code,{children:`{{referenced_column}}`}),` is the list of the referencing column name. So for unique key on `,_jsx(_components.code,{children:`user(id, name)`}),`, the legal name is `,_jsx(_components.code,{children:`uk_user_id_name`}),`.`]}),`\n`,_jsx(_components.p,{children:`It also limits the naming max length. The default maximum length is 64 characters. Length limit does not support PostgreSQL.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-fk.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=ea0adbb7523b460bed316e64b4add8a4`,alt:`schema-review-naming-index-fk`,\"data-og-width\":`923`,width:`923`,\"data-og-height\":`354`,height:`354`,\"data-path\":`content/docs/sql-review/schema-review-naming-index-fk.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-fk.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=3f061771dab96bfef8206f16ce305f58 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-fk.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=9469e4f7c0836c54b767f9c82a0fa658 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-fk.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=476f69c1e04bdda6e9223ebda858fc07 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-fk.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=e928441a3e01c667c8dd422e351f2c0f 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-fk.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=9f6c3615fe247d30a91333cf275a8745 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-naming-index-fk.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=0db76dfe75f80f3fb71e7ea248c6a5a2 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-9`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks that all foreign key names in DDL conform to the naming conventions.`}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Foreign Key Naming Convention`}),` rule is only valid for foreign key, which means it does `,_jsx(_components.strong,{children:`NOT`}),` work for index, unique key and primary key.\nAlso see index naming convention, primary key naming convention and unique key naming convention.`]})}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE ADD CONSTRAINT`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-9`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`naming.table.no-keyword`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-keywords-as-table-names`,children:`Disallow keywords as table names`}),`\n`,_jsx(_components.p,{children:`Using keywords as table names in Oracle, or any other database management system, is generally not recommended for several reasons:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Reserved Keywords: Database systems have a set of reserved keywords that are used for defining the structure and operations of the database. These keywords have specific meanings and functionalities within the system. If you use a reserved keyword as a table name, it can lead to conflicts and ambiguity when executing queries or performing operations on the table.`}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Query Conflicts: When you use a reserved keyword as a table name, it can cause conflicts and confusion when constructing SQL queries. The database may interpret the keyword as a command or function instead of a table name, resulting in unexpected behavior or errors. It becomes necessary to use special techniques or syntax to differentiate the table name from the keyword, which can make the queries more complex and error-prone.`}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Code Readability: Using keywords as table names can make the code less readable and maintainable. Table names are meant to represent the entities or concepts they represent in the system. Choosing descriptive and meaningful names for tables improves code clarity and understanding. When keywords are used, it can be challenging for developers, administrators, or future maintainers to grasp the purpose and usage of the tables quickly.`}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Portability: If you decide to migrate your database from one DBMS to another in the future, using keywords as table names can cause compatibility issues. Different database systems have different sets of reserved keywords, and these keywords may vary in meaning and functionality. Migrating a database containing table names that are keywords in the target DBMS may require modifying the table names or using workarounds, which can be time-consuming and error-prone.`}),`\n`]}),`\n`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-table-no-keyword.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=2f48edf74b5600066618a13bb3b674a5`,alt:`sql-review-naming-table-no-keyword`,\"data-og-width\":`1816`,width:`1816`,\"data-og-height\":`644`,height:`644`,\"data-path\":`content/docs/sql-review/sql-review-naming-table-no-keyword.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-table-no-keyword.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=82fc4a12e4a7e0e696b9d9186ef80e6c 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-table-no-keyword.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=73709a955998f8127767c0e12f46ed2b 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-table-no-keyword.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=9baa3be109d96e352d8305c6fbe3820d 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-table-no-keyword.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=1558fd70d0a9d1cbb9029cf3a4ec8897 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-table-no-keyword.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=963ca211a062b748db69c1822c9a455f 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-table-no-keyword.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=c78127b0c1d54f700d6a42854733e3e2 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-10`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`Snowflake`}),`\n`]}),`\n`,_jsx(`div`,{id:`naming.identifier.no-keyword`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-keywords-as-identifiers`,children:`Disallow keywords as identifiers`}),`\n`,_jsxs(_components.p,{children:[`The same reason as `,_jsx(_components.code,{children:`Disallow keywords as table names`}),` above.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-no-keyword.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=1af49db8842064730dcd076072066f89`,alt:`sql-review-naming-identifier-no-keyword`,\"data-og-width\":`1818`,width:`1818`,\"data-og-height\":`644`,height:`644`,\"data-path\":`content/docs/sql-review/sql-review-naming-identifier-no-keyword.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-no-keyword.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=b104d6f7fc66fa0fc59236738995d301 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-no-keyword.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=94afe31e9059e73a201938f5eab297ea 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-no-keyword.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=0d32c88a7057a3d2e5f6fd720915f701 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-no-keyword.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f8a8d36a2ca960aeb0d5cbc3bf200b36 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-no-keyword.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=6beb3226ea5993caf95dca5772e09533 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-no-keyword.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=47e5787d76a2d25172ef77fef16a60b2 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-11`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`Snowfake`}),`\n`]}),`\n`,_jsx(`div`,{id:`naming.identifier.case`}),`\n`,_jsx(Heading,{level:`3`,id:`identifier-case`,children:`Identifier case`}),`\n`,_jsx(_components.p,{children:`Bytebase provides this rule to unify the identifier case.`}),`\n`,_jsx(_components.p,{children:`For Oracle, if the identifier is not quoted, it is converted to uppercase. In order to unify the identifier case, you can use this rule to disallow the lowercase identifier.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-case.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=1396cf6378e4ffbf06ca96c521112fc2`,alt:`sql-review-naming-identifier-case`,\"data-og-width\":`1818`,width:`1818`,\"data-og-height\":`644`,height:`644`,\"data-path\":`content/docs/sql-review/sql-review-naming-identifier-case.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-case.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=cba5f0df86f165f2db2925d0aefc0b8e 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-case.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=769c7cefc54fee33ae2875496e29c1f0 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-case.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=4a1747016b192733ce9098b4022a2930 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-case.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=a5fdb4d681299875c937f1267441a6f6 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-case.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5ba9098610b51064eb4e9e3b65d2a700 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-naming-identifier-case.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5eb4a19b07beed2692a48bdc4018ea7a 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-12`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`Snowflake`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`statement`,children:`Statement`}),`\n`,_jsx(`div`,{id:`statement.select.no-select-all`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-select`,children:`Disallow SELECT *`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`SELECT *`}),` introduces additional performance cost or ambiguous semantics.`]}),`\n`,_jsx(_components.p,{children:`For scenarios where all columns are not required, you should SELECT the columns you need to avoid getting unneeded data.`}),`\n`,_jsxs(_components.p,{children:[`For scenarios where all columns are required, you should list all column names to avoid semantic ambiguity. Otherwise, the data consumer cannot know the column information. And `,_jsx(_components.code,{children:`SELECT *`}),` may bring additional modifications and errors when modifying the table schema.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-select-no-select-all.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=b069d8782cd5abdd852f7ef04f6ffb53`,alt:`schema-review-query-select-no-select-all`,\"data-og-width\":`933`,width:`933`,\"data-og-height\":`355`,height:`355`,\"data-path\":`content/docs/sql-review/schema-review-query-select-no-select-all.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-select-no-select-all.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=234fd43d63197ddccf9ce76a5a1a076e 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-select-no-select-all.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=a165e991c2cc376c6f2b3dba8d6b0d06 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-select-no-select-all.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=f67229c7f5ff5c13b978ea43d85d92b8 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-select-no-select-all.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=8bfe7607165ec883fc5418dad86ecafb 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-select-no-select-all.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=818fc68feaf661fbc7277861b25945d4 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-select-no-select-all.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=0b7694c640e5a4a554439d33bf50877e 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-10`,children:`How the rule works`}),`\n`,_jsxs(_components.p,{children:[`Bytebase considers this rule to be violated if the SQL has `,_jsx(_components.code,{children:`SELECT *`}),`.`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-13`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.where.require`}),`\n`,_jsx(Heading,{level:`3`,id:`require-where`,children:`Require WHERE`}),`\n`,_jsx(_components.p,{children:`There are countless stories about people forgetting the WHERE clause in an UPDATE or DELETE and losing data. In queries, not using WHERE can also cause performance issues.`}),`\n`,_jsxs(_components.p,{children:[`If you are sure you need to act on all data, use `,_jsx(_components.code,{children:`WHERE 1=1`}),` to remind yourself of the consequences of that action.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-require.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=a07962d9cb88f721dafa6c5456c68e3f`,alt:`schema-review-query-where-require`,\"data-og-width\":`934`,width:`934`,\"data-og-height\":`354`,height:`354`,\"data-path\":`content/docs/sql-review/schema-review-query-where-require.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-require.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=0642fd84f6da75940694015d7ec49443 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-require.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=3e3a8cac8b3ca5b0b24df79760268427 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-require.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=a2d70d99b0348f1883a02d6f41c32ff9 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-require.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=fff927586fca10969140e596504c21fd 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-require.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=9bd02ff994fd66f966c3f6a783e3a12f 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-require.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=ec00f018efbfaf9b9e4dca6a3154f7f7 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-11`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase considers this rule to be violated if the SQL has no WHERE clause.`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-14`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`,_jsx(_components.li,{children:`Snowflake`}),`\n`,_jsx(_components.li,{children:`SQL Server`}),`\n`,_jsx(_components.li,{children:`MariaDB`}),`\n`,_jsx(_components.li,{children:`BigQuery`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.where.no-leading-wildcard-like`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-leading-%-in-like`,children:`Disallow leading % in LIKE`}),`\n`,_jsx(_components.p,{children:`Database cannot use an index to match entries when there is a leading wildcard. It can cause serious performance problems because it may scan the entire table.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-no-leading-wildcard-like.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=db8fe695a92d05cfbd91870e61634a99`,alt:`schema-review-query-where-no-leading-wildcard-like`,\"data-og-width\":`929`,width:`929`,\"data-og-height\":`354`,height:`354`,\"data-path\":`content/docs/sql-review/schema-review-query-where-no-leading-wildcard-like.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-no-leading-wildcard-like.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=ccdfdcacf68e2e6606d1f0344ff593c7 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-no-leading-wildcard-like.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=c15257ef0f98419ba131fb59370b4b55 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-no-leading-wildcard-like.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=2fd4ecab4ecba041d28f8ed6b00276c7 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-no-leading-wildcard-like.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=42c27c3637828666a5794739d7ad4848 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-no-leading-wildcard-like.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=f342528785c3da471ff2e584192e97a2 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-query-where-no-leading-wildcard-like.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=b6968a091c79c82a1ef36f84431b22ff 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-12`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase considers this rule to be violated if the SQL has leading wildcard LIKE.`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-15`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.disallow-commit`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-commit`,children:`Disallow COMMIT`}),`\n`,_jsx(_components.p,{children:`Disallow using COMMIT statement.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-commit.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=869db4c75cc01529cb4a359dd339c4fc`,alt:`sql-review-statement-disallow-commit`,\"data-og-width\":`924`,width:`924`,\"data-og-height\":`328`,height:`328`,\"data-path\":`content/docs/sql-review/sql-review-statement-disallow-commit.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-commit.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=3a7341c9ec94e821416fbc6d3ad4914a 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-commit.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=c2d244175d7f49ff0f27fa1310486f4f 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-commit.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=d15a5cd11c88a826027194fa7a33ef60 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-commit.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=1bb673761cad085f97ce36c267f6c7b9 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-commit.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=635b7fc73e21154d07461770d593f037 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-commit.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=7fb4b80d0d35491c25112ccdbde52b9c 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-13`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase alerts users if there exists COMMIT statement.`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-16`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.disallow-limit`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-limit`,children:`Disallow LIMIT`}),`\n`,_jsx(_components.p,{children:`Disallow LIMIT clause for INSERT, UPDATE and DELETE statements.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-limit.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=cefde673711c4be2d588da5606d01e05`,alt:`sql-review-statement-disallow-limit`,\"data-og-width\":`921`,width:`921`,\"data-og-height\":`349`,height:`349`,\"data-path\":`content/docs/sql-review/sql-review-statement-disallow-limit.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-limit.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=7970ff9a7305949d2f37d9a5fa43e817 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-limit.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=069be026f3b2fdee19300ef02d6a86c1 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-limit.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=dce1be6e333e5a66abc685f1fbc3c883 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-limit.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f902fc10bba97f4d1efc6eb509b5fee2 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-limit.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=da6897f2d171138ed8c86e46a6efa415 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-limit.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=fa606bd381bff3aeff428586bbf865c7 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-14`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`INSERT`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`UPDATE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`DELETE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-17`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Support for PostgreSQL is coming soon.`}),`\n`,_jsx(`div`,{id:`statement.disallow-order-by`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-order-by`,children:`Disallow ORDER BY`}),`\n`,_jsx(_components.p,{children:`Disallow ORDER BY clause for UPDATE and DELETE statements.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-order-by.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=dcd8f4cdccd54c765b6a97f726a09416`,alt:`sql-review-statement-disallow-order-by`,\"data-og-width\":`917`,width:`917`,\"data-og-height\":`350`,height:`350`,\"data-path\":`content/docs/sql-review/sql-review-statement-disallow-order-by.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-order-by.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=487ce83c6008e84aa45c5a1b005349c8 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-order-by.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5aaeb9e9e6c92ea4df78abe30608b925 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-order-by.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f7054836cf92455f756b1ec270471870 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-order-by.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e264acd67a954a681cc1c456e574a73b 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-order-by.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=d11349877c60f51956b2a780f81974b9 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-order-by.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=1a931edba046f0e4a22541c1fb211c9c 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-15`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`UPDATE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`DELETE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-18`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Support for PostgreSQL is coming soon.`}),`\n`,_jsx(`div`,{id:`statement.merge-alter-table`}),`\n`,_jsx(Heading,{level:`3`,id:`merge-alter-table`,children:`Merge ALTER TABLE`}),`\n`,_jsxs(_components.p,{children:[`For readability, it’s better not to use multiple `,_jsx(_components.code,{children:`ALTER TABLE`}),` statements for the same table.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-merge-alter-table.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=d1ef2f7543fa4ac5c6a8f88e40b1c5c8`,alt:`sql-review-statement-merge-alter-table`,\"data-og-width\":`918`,width:`918`,\"data-og-height\":`348`,height:`348`,\"data-path\":`content/docs/sql-review/sql-review-statement-merge-alter-table.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-merge-alter-table.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=09463a0a16f318d57be71505f7e2314a 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-merge-alter-table.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=7b6336590c2df668754e48fb91c10c15 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-merge-alter-table.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=cab9efb0b1c530bfe7354f9019b8e9d6 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-merge-alter-table.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=17a0dbe8258963dda47151fdaf000d08 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-merge-alter-table.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=664424b5d61ec0ed43de79d2a4a13906 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-merge-alter-table.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=7a8e7025bbc95407fd3e90d950594a68 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-16`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-19`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.insert.must-specify-column`}),`\n`,_jsx(Heading,{level:`3`,id:`insert-statements-must-specify-columns`,children:`INSERT statements must specify columns`}),`\n`,_jsxs(_components.p,{children:[`For readability, it’s better to explicitly specify columns for INSERT statements, such as `,_jsx(_components.code,{children:`INSERT INTO table_t(id, name) VALUES(...)`}),`.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-must-specify-column.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=c6f55b1bf604a7b3b657639a561bb7d6`,alt:`sql-review-statement-insert-must-specify-column`,\"data-og-width\":`918`,width:`918`,\"data-og-height\":`350`,height:`350`,\"data-path\":`content/docs/sql-review/sql-review-statement-insert-must-specify-column.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-must-specify-column.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=3cb7cc0317c013cdea3ae0c2c9220e0d 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-must-specify-column.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=29973e6e4c2144fd59d2dbd599d1ae4f 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-must-specify-column.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=50d418b6aa08852e95e0a4ef8d3e9dc6 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-must-specify-column.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=9338f5ff105c9584668a03a5b7bf26c5 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-must-specify-column.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=483aa3892f69825e3e6cd3635d71d523 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-must-specify-column.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=15ae202d31e83225bf9a6d07b7115c06 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-17`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`INSERT`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-20`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.insert.disallow-order-by-rand`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-order-by-rand-in-insert-statements`,children:`Disallow ORDER BY RAND in INSERT statements`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`ORDER BY RAND()`}),` clause is not necessary for INSERT statements.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-disallow-order-by-rand.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=7f3d01b344a0129bab29bac3c5766dd1`,alt:`sql-review-statement-insert-disallow-order-by-rand`,\"data-og-width\":`922`,width:`922`,\"data-og-height\":`348`,height:`348`,\"data-path\":`content/docs/sql-review/sql-review-statement-insert-disallow-order-by-rand.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-disallow-order-by-rand.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=408b9213bdae3ea089896023373c1414 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-disallow-order-by-rand.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=57d95be52bd89e2f974af25b60a047ce 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-disallow-order-by-rand.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=65833d347f25b286062cc0f89b7c8e81 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-disallow-order-by-rand.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e4b2dcf9e220aefe82a0cbbcfb4f0279 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-disallow-order-by-rand.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f0f7f11eb02862463abdb8e0a4b6adb3 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-disallow-order-by-rand.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=bb3321bd7e26c263649d844bf872f253 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-18`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`INSERT`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-21`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.insert.row-limit`}),`\n`,_jsx(Heading,{level:`3`,id:`limit-the-inserted-rows`,children:`Limit the inserted rows`}),`\n`,_jsx(_components.p,{children:`Alert users if the inserted rows exceed the limit.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-row-limit.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f373767d5633a51dc577c4ef3896412b`,alt:`sql-review-statement-statement-insert-row-limit`,\"data-og-width\":`919`,width:`919`,\"data-og-height\":`364`,height:`364`,\"data-path\":`content/docs/sql-review/sql-review-statement-insert-row-limit.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-row-limit.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=bc5222de1bf8b5f685b7b8a23b645337 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-row-limit.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5474454b6dd1a07ee2f43176ebb8da6b 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-row-limit.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=729206d46a0f48fc9a3a13a0297065f8 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-row-limit.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=da6df83594746bbc5d9879a40e7d86bb 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-row-limit.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=47ccae5c0d2d16f20d5c001530318a8d 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-insert-row-limit.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=55da2229b1ce9eb66a738fc47531c716 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-19`,children:`How the rule works`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`For `,_jsx(_components.code,{children:`INSERT INTO ... VALUES(...)`}),` statements, Bytebase checks the count of value list.`]}),`\n`,_jsxs(_components.li,{children:[`For `,_jsx(_components.code,{children:`INSERT INTO ... SELECT ...`}),` statements, Bytebase runs `,_jsx(_components.code,{children:`EXPLAIN`}),` statements for them and check the rows in `,_jsx(_components.code,{children:`EXPLAIN`}),` statement results.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-22`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.affected-row-limit`}),`\n`,_jsx(Heading,{level:`3`,id:`limit-affected-row-limit`,children:`Limit affected row limit`}),`\n`,_jsxs(_components.p,{children:[`Alert users if the affected rows in `,_jsx(_components.code,{children:`UPDATE`}),` or `,_jsx(_components.code,{children:`DELETE`}),` exceed the limit.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-affected-row-limit.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=ca37e7e30405f5d2dc7ef9265a77d9e0`,alt:`sql-review-statement-affected-row-limit`,\"data-og-width\":`921`,width:`921`,\"data-og-height\":`347`,height:`347`,\"data-path\":`content/docs/sql-review/sql-review-statement-affected-row-limit.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-affected-row-limit.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=df02679ffc58ec6c942d0d1005d3fd61 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-affected-row-limit.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=347ae520542c7d4d18695cb8309c7b9a 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-affected-row-limit.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e48620edd030343f8905af1b7ea5f6ff 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-affected-row-limit.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f16cf5f3ce5b2d8aad93ca1b1b613dde 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-affected-row-limit.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5c3959d5d6735d651e988b402a7f39d4 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-affected-row-limit.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=409299efaacfb90c90316ed5360fc832 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-20`,children:`How the rule works`}),`\n`,_jsxs(_components.p,{children:[`For `,_jsx(_components.code,{children:`UPDATE`}),` and `,_jsx(_components.code,{children:`DELETE`}),` statements, Bytebase runs `,_jsx(_components.code,{children:`EXPLAIN`}),` statements for them and check the rows in `,_jsx(_components.code,{children:`EXPLAIN`}),` statement results.`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-23`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.dml-dry-run`}),`\n`,_jsx(Heading,{level:`3`,id:`dry-run-dml-statements`,children:`Dry run DML statements`}),`\n`,_jsx(_components.p,{children:`Dry run DML statements for validation.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-dml-dry-run.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=79532e3cec9fbe4a0a1408b20e8537be`,alt:`sql-review-statement-dml-dry-run`,\"data-og-width\":`924`,width:`924`,\"data-og-height\":`346`,height:`346`,\"data-path\":`content/docs/sql-review/sql-review-statement-dml-dry-run.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-dml-dry-run.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=107c79f98f63026034b30ddce421dfde 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-dml-dry-run.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=a07f66534cde29bf1f6e960699e3fbd2 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-dml-dry-run.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=40abc062b91f2f68ff4e8134bfdef2d2 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-dml-dry-run.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=8d29072c144f1233b4907d48409d88c8 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-dml-dry-run.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=255c6a8a5c228616a14bf60a68d18ef7 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-dml-dry-run.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5e7b219199793953aec679b4020d4a3f 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-21`,children:`How the rule works`}),`\n`,_jsxs(_components.p,{children:[`Dry run DML statements by `,_jsx(_components.code,{children:`EXPLAIN`}),` statements. Specifically, Bytebase checks:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`INSERT`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`UPDATE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`DELETE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-24`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.disallow-add-column-with-default`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-add-column-with-default`,children:`Disallow add column with default`}),`\n`,_jsx(_components.p,{children:`The PostgreSQL will lock the table and rewrite the whole table when you adding column with default value. You can separate the adding column, setting default value and backfilling all existing rows.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-column-with-default.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=ed1cc5f8c05494c8e8d807e5c249d8c7`,alt:`sql-review-statement-disallow-add-column-with-default`,\"data-og-width\":`1476`,width:`1476`,\"data-og-height\":`650`,height:`650`,\"data-path\":`content/docs/sql-review/sql-review-statement-disallow-add-column-with-default.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-column-with-default.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=c3d0ba14d9ebd575dc1dc95d93c8d92b 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-column-with-default.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=ce5383079322df52c8c017f7c563c9b6 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-column-with-default.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=fe07dbb98dc6a0a532210de444aad213 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-column-with-default.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e63f287ce13b7b103bfd79f0d570b0b7 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-column-with-default.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5d08301aaf3568d78b1e88f7604c5aee 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-column-with-default.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=899e46620a8a132dbb5227e4bf95d58f 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-22`,children:`How the rule works`}),`\n`,_jsxs(_components.p,{children:[`Bytebase checks all `,_jsx(_components.code,{children:`ALTER TABLE ADD COLUMN`}),` statements.`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-25`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.add-check-not-valid`}),`\n`,_jsx(Heading,{level:`3`,id:`add-check-constraints-with-not-valid-option`,children:`Add CHECK constraints with NOT VALID option`}),`\n`,_jsx(_components.p,{children:`Adding CHECK constraints without NOT VALID can cause downtime because it blocks reads and writes. You can manually verify all rows and validate the constraint after creating.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-add-check-not-valid.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=bd5a2e35664e4015b4ac9cee51913404`,alt:`sql-review-statement-add-check-not-valid`,\"data-og-width\":`1778`,width:`1778`,\"data-og-height\":`696`,height:`696`,\"data-path\":`content/docs/sql-review/sql-review-statement-add-check-not-valid.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-add-check-not-valid.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5c538aee1b585bb67692713937a766bc 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-add-check-not-valid.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=d0f2b90a686aef389af5b0b8460f10ab 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-add-check-not-valid.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=8229b88bc6093e5c9d742b9751cacc36 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-add-check-not-valid.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=7e220554173c655930534a6169cc73ac 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-add-check-not-valid.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5e9de0dd4f14b3acf6fe2c1704049d0d 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-add-check-not-valid.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=4b40b06fc47c375760e4da10364e1852 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-23`,children:`How the rule works`}),`\n`,_jsxs(_components.p,{children:[`Bytebase checks all `,_jsx(_components.code,{children:`ALTER TABLE ADD CONSTRAINT`}),` statements.`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-26`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`]}),`\n`,_jsx(`div`,{id:`statement.disallow-add-not-null`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-add-not-null-constraints-to-an-existing-column`,children:`Disallow add NOT NULL constraints to an existing column`}),`\n`,_jsx(_components.p,{children:`It can cause downtime because it blocks reads and writes. You can add CHECK(column IS NOT NULL) constraints with NOT VALID option to avoid this.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-not-null.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=509adc3482c0184e7f71666d6944edd4`,alt:`sql-review-statement-disallow-add-not-null`,\"data-og-width\":`1820`,width:`1820`,\"data-og-height\":`682`,height:`682`,\"data-path\":`content/docs/sql-review/sql-review-statement-disallow-add-not-null.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-not-null.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=406641d2897b8251ef4ea47605943e64 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-not-null.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=584675b978446f43246ce8b869569714 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-not-null.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=d37b61883c98592780406410e7b472e6 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-not-null.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=2c1664bda645cb3bee50cd78cc5b3381 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-not-null.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=72a2c8c1f04a36091529484a177ec922 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-statement-disallow-add-not-null.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=83d190947f9dc02289297381f82bc921 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-24`,children:`How the rule works`}),`\n`,_jsxs(_components.p,{children:[`Bytebase checks all `,_jsx(_components.code,{children:`ALTER TABLE ADD CONSTRAINT`}),` statements.`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-27`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`table`,children:`Table`}),`\n`,_jsx(`div`,{id:`table.limit-size`}),`\n`,_jsx(Heading,{level:`3`,id:`limit-ddl-operations-on-tables-with-large-data-volumes`,children:`Limit DDL operations on tables with large data volumes`}),`\n`,_jsx(_components.p,{children:`DDL operations on large tables can cause long locks because they need exclusive access to update the table’s structure and metadata, which takes more time for bigger tables.`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-25`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase considers this rule to be violated if the SQL tries to apply DDL operations on a table with sizes exceeding the set value.`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-28`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`]}),`\n`,_jsx(`div`,{id:`table.require-pk`}),`\n`,_jsx(Heading,{level:`3`,id:`require-primary-key`,children:`Require primary key`}),`\n`,_jsx(_components.p,{children:`In almost all cases, each table needs a primary key.`}),`\n`,_jsxs(_components.p,{children:[`e.g. in MySQL, `,_jsx(_components.a,{href:`https://dev.mysql.com/doc/refman/8.0/en/innodb-index-types.html`,children:`the InnoDB storage engine always creates a primary key`}),` if you didn’t specify it explicitly or didn’t create a unique key, thus making an extra column you don’t have access to.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-require-pk.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=440f24053cfd7380f62f8299c512733d`,alt:`schema-review-table-require-pk`,\"data-og-width\":`930`,width:`930`,\"data-og-height\":`357`,height:`357`,\"data-path\":`content/docs/sql-review/schema-review-table-require-pk.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-require-pk.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=84c8c8be3535d3f2abefe1880829b5e7 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-require-pk.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=ff25927e027d218d1d4b103bb3ade21d 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-require-pk.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=35658c5d761bd3a7598e9f8ea695ea4f 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-require-pk.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=6d45a09801f191e44c26d71e944e0cfd 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-require-pk.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=13db877988cfe628582dd5c863129e9e 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-require-pk.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=caa77dd9ea6a9d081705c32946985e87 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-26`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase considers this rule to be violated if the SQL tries to create a no primary key table or drop the primary key. If the SQL drops all columns in the primary key, Bytebase also considers that this SQL drops the primary key.`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-29`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`,_jsx(_components.li,{children:`Snowflake`}),`\n`]}),`\n`,_jsx(`div`,{id:`table.no-foreign-key`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-foreign-key`,children:`Disallow foreign key`}),`\n`,_jsx(_components.p,{children:`This rule disallows users to create foreign key in the table.`}),`\n`,_jsx(_components.p,{children:`A foreign key is a logical association of rows between two tables, in a parent-child relationship. A row in a “parent” table may be referenced by one or more rows in a “child” table.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`FOREIGN KEY`}),` constraints are impossible to maintain once your data grows and is split over multiple database servers. This typically happens when you introduce functional partitioning/sharding and/or horizontal sharding.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-no-fk.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=97d47e679b625e43905ecd6caa706235`,alt:`schema-review-table-no-fk`,\"data-og-width\":`2006`,width:`2006`,\"data-og-height\":`962`,height:`962`,\"data-path\":`content/docs/sql-review/schema-review-table-no-fk.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-no-fk.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=636baebaa96dbbae833d377c9c86818b 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-no-fk.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=94d2bd9586bd78c64b931447969d29d3 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-no-fk.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=2789374f5429ac67cc0f063556ba78c3 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-no-fk.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=5df43f913eb35abaf0d1bd4cdd9bc31a 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-no-fk.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=4a628e8b2e9fa9c9b43abcae4725d5aa 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-no-fk.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=475a5831d35dee5cf12a1a91a37c5baf 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-27`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase considers this rule to be violated if the SQL tries to:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statement with foreign key`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE ADD CONSTRAINT FOREIGN KEY`}),` statement`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-30`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`,_jsx(_components.li,{children:`Snowflake`}),`\n`]}),`\n`,_jsx(`div`,{id:`table.drop-naming-convention`}),`\n`,_jsx(Heading,{level:`3`,id:`drop-naming-convention`,children:`Drop naming convention`}),`\n`,_jsx(_components.p,{children:`Only tables named with specific naming patterns can be deleted. This requires users to do a rename and then drop the table.`}),`\n`,_jsxs(_components.p,{children:[`The naming convention uses `,_jsx(_components.a,{href:`https://en.wikipedia.org/wiki/Regular_expression`,children:`regular expression`}),` format. By default the table name must have `,_jsx(_components.code,{children:`_del`}),` suffix.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-drop-naming.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=59762b1143036637740ea4fa8c856f41`,alt:`schema-review-table-drop-naming`,\"data-og-width\":`1956`,width:`1956`,\"data-og-height\":`932`,height:`932`,\"data-path\":`content/docs/sql-review/schema-review-table-drop-naming.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-drop-naming.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=8d9bdac09ec9e30562e5221bdc9cece4 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-drop-naming.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=7cadf73fc283de26fa451c5ac6a57115 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-drop-naming.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=9c77709688dbd9df0d3058becfe73bb2 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-drop-naming.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=dc9843ebf9d4ad99351d37353ba3d6a5 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-drop-naming.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=fbd86c65bf6254b2268f63b43c7d8912 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-table-drop-naming.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=058b3e4d0d7b80cd8e6953903a2854d6 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-28`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks that the table names in DDL conform to the naming conventions.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`DROP TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-31`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`table.disallow-partition`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-partition-table`,children:`Disallow partition table`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-disallow-partition.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=9c2c0bc50f9e314096cf5c4f79112962`,alt:`sql-review-table-disallow-partition`,\"data-og-width\":`922`,width:`922`,\"data-og-height\":`346`,height:`346`,\"data-path\":`content/docs/sql-review/sql-review-table-disallow-partition.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-disallow-partition.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=d988d78f81d97cd7cbc15c738e32465c 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-disallow-partition.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=00722f58900d364a5c6e81dcd2d62d9f 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-disallow-partition.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=de36e3008d7c947e7308e4d1ca181279 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-disallow-partition.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=38757db8174559f376be0014434fd743 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-disallow-partition.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=8c145c53e9affab174426492ceedaf13 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-disallow-partition.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=1d86c855e715450b2fa715418eab7664 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-29`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if the SQL statement will create the partition table.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-32`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`table.comment`}),`\n`,_jsx(Heading,{level:`3`,id:`table-comment-convention`,children:`Table comment convention`}),`\n`,_jsx(_components.p,{children:`Configure whether the table requires comments and the maximum comment length.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-comment.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=effe021981347eb203104da23ab51211`,alt:`sql-review-table-comment`,\"data-og-width\":`926`,width:`926`,\"data-og-height\":`350`,height:`350`,\"data-path\":`content/docs/sql-review/sql-review-table-comment.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-comment.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5a661432ab471cd0a3d2c5d83b536bb8 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-comment.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=6dff7ba8c3c1da531cd26d20fb1d4a98 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-comment.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=6f7a74bf744d900a56133549ab6b6348 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-comment.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f448b0573cdbd659db6f4fe04a03582f 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-comment.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=8b33bed5e4946e7d6ae8bc1b9df9afc8 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-table-comment.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=b62e22a674b38b99819081f86701a8da 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-30`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the table comment convention.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-33`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`schema`,children:`Schema`}),`\n`,_jsx(`div`,{id:`schema.backward-compatibility`}),`\n`,_jsx(Heading,{level:`3`,id:`backward-incompatible-schema-change`,children:`Backward incompatible schema change`}),`\n`,_jsxs(_components.p,{children:[`Introducing backward incompatible schema changes is one of the most common mistakes made by developers. And enforcing backward compatible schema change is the standard practice adopted by many engineering organizations. Bytebase provides the built-in backward compatible check to catch all common incompatible schema change `,_jsx(_components.a,{href:`https://www.bytebase.com/docs/sql-review/error-codes/#compatibility`,children:`scenarios`}),`.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-schema-backward-compatibility.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=50f3effd7c2d024002ff4211c3fc5773`,alt:`schema-review-schema-backward-compatibility`,\"data-og-width\":`950`,width:`950`,\"data-og-height\":`369`,height:`369`,\"data-path\":`content/docs/sql-review/schema-review-schema-backward-compatibility.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-schema-backward-compatibility.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=6dcf658388527e9b1072e92f0dcb9e94 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-schema-backward-compatibility.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=323b25a3a24f4ccea1a0d15e64a737fb 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-schema-backward-compatibility.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=72eac072abcaa3365536947dd8af1034 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-schema-backward-compatibility.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=a2747505f18e04bbabc6ab01efe62ee7 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-schema-backward-compatibility.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=3a40a0e80a1eecbc62ee0bcbdb850a8b 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-schema-backward-compatibility.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=fc9dcea422135fe3692934afb22f01e6 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-31`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`If the following situation occurs, Bytebase considers this rule to be violated:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Drop database`}),`\n`,_jsx(_components.li,{children:`Rename table/view`}),`\n`,_jsx(_components.li,{children:`Drop table/view`}),`\n`,_jsx(_components.li,{children:`Rename column`}),`\n`,_jsx(_components.li,{children:`Drop column`}),`\n`,_jsx(_components.li,{children:`Add primary key`}),`\n`,_jsx(_components.li,{children:`Add Unique key`}),`\n`,_jsx(_components.li,{children:`Add Foreign key`}),`\n`,_jsx(_components.li,{children:`Add check enforced`}),`\n`,_jsx(_components.li,{children:`Alter check enforced`}),`\n`,_jsx(_components.li,{children:`Modify column`}),`\n`,_jsx(_components.li,{children:`Change column`}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-34`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`column`,children:`Column`}),`\n`,_jsx(`div`,{id:`column.required`}),`\n`,_jsx(Heading,{level:`3`,id:`enforce-the-required-columns-in-each-table`,children:`Enforce the required columns in each table`}),`\n`,_jsxs(_components.p,{children:[`For most projects, you may want to enforce some columns for every table. For example, need `,_jsx(_components.code,{children:`id`}),` as identification and the primary key for each table or need `,_jsx(_components.code,{children:`created_ts`}),` and `,_jsx(_components.code,{children:`updated_ts`}),` to record creation and modification times.`]}),`\n`,_jsx(_components.p,{children:`You can customize which columns are required.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-required.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=1ac0ea4d43a48ffd46258bbca01a453d`,alt:`schema-review-column-required`,\"data-og-width\":`930`,width:`930`,\"data-og-height\":`362`,height:`362`,\"data-path\":`content/docs/sql-review/schema-review-column-required.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-required.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=ce7df3e00fdd09120487cbab04801866 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-required.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=593f6bf6c57b8841149aa192497f61d8 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-required.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=35bcc2d2ef1bda8c2017aea7d6838beb 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-required.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=426220f4733c4b3a01160dd79e0494a2 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-required.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=27fdd634c417f755974aa689a8b58f67 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-required.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=46902340e635e2dde1ce84d4d9d2a74d 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-32`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase defaults all tables to meet the requirements. If the SQL tries to define a table not having all the required columns or attempts to drop the required column, Bytebase considers this rule to be violated.`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-35`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`,_jsx(_components.li,{children:`Snowflake`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.type-disallow-list`}),`\n`,_jsx(Heading,{level:`3`,id:`column-type-disallow-list`,children:`Column type disallow list`}),`\n`,_jsx(_components.p,{children:`Set column type disallow list to ban column types.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-list.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=93bb933994fa5852217cb4be2faa1b82`,alt:`sql-review-column-disallow-list`,\"data-og-width\":`925`,width:`925`,\"data-og-height\":`350`,height:`350`,\"data-path\":`content/docs/sql-review/sql-review-column-disallow-list.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-list.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=9b280c10f060d559916b5e488d5ea6bb 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-list.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=63f7ddb1474a9219d6f2b7d3a61d3c9b 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-list.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=aa0d9b1ecba73e99a395759cb68c2951 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-list.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=bda6e13a97055dcc79f3cf417103b6d5 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-list.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=ec436d6a42f6845413ed07e03df354f7 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-list.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=6e7dba1ddb58ce507c41b48fbdbd40c3 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-33`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if the SQL statement creates the column type in the disallow list.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-36`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.no-null`}),`\n`,_jsx(Heading,{level:`3`,id:`columns-no-null-value`,children:`Columns no NULL value`}),`\n`,_jsx(_components.p,{children:`NULL is a special value. It can cause confusion or performance issues. Bytebase provides this rule to enforce that all columns cannot have NULL value.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-no-null.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=1609694febcdc3a61460252ac03be37f`,alt:`schema-review-column-no-null`,\"data-og-width\":`931`,width:`931`,\"data-og-height\":`361`,height:`361`,\"data-path\":`content/docs/sql-review/schema-review-column-no-null.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-no-null.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=61fd08e19a7e4a95d69a67b58d5dc0f6 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-no-null.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=187632b37ab6a24d696338db0fe1537f 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-no-null.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=f267f36a642dde9f83e6cf3c1c7427be 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-no-null.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=62ba909fabaa02a00371afd29ff70a38 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-no-null.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=a6cee274c0c82af4403d54d77ca86713 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-column-no-null.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=cef16763351a7c15ec6d8729e4ec9f87 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-34`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase considers this rule to be violated if the SQL defines a column allowing NULL value.`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-37`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`,_jsx(_components.li,{children:`Snowflake`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.disallow-change-type`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-changing-column-type`,children:`Disallow changing column type`}),`\n`,_jsx(_components.p,{children:`Changing column type may fail because the data cannot be converted. Bytebase provides this rule to alert you that the SQL statement would change the column type.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-type.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=546c085b855585b7af073825b6919aed`,alt:`sql-review-column-disallow-change-type`,\"data-og-width\":`928`,width:`928`,\"data-og-height\":`353`,height:`353`,\"data-path\":`content/docs/sql-review/sql-review-column-disallow-changing-type.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-type.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=eeffc6341be19905024880acc56cdc21 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-type.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e6d514502ef2366010133d74c294afae 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-type.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=179e1c472bd34c5f115ab3c431b5e487 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-type.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=7bfdf4936827651538785006bdc40831 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-type.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=416cb249458fe2447f2e103aeb30db5a 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-type.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=96a8493ba49039faf2e550842bcba9bd 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-35`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if the SQL statement will change the column type.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-38`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.set-default-for-not-null`}),`\n`,_jsx(Heading,{level:`3`,id:`set-default-value-for-not-null-columns`,children:`Set DEFAULT value for NOT NULL columns`}),`\n`,_jsx(_components.p,{children:`NOT NULL columns have no default value. It requires users to manually set default values for NOT NULL columns.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-set-default-for-not-null.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=13d7e9ef614e512b30a0bdbdd90f83fe`,alt:`sql-review-column-set-default-for-not-null`,\"data-og-width\":`928`,width:`928`,\"data-og-height\":`349`,height:`349`,\"data-path\":`content/docs/sql-review/sql-review-column-set-default-for-not-null.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-set-default-for-not-null.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=a53975b0c14611f9ff0e2ef5cc004b12 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-set-default-for-not-null.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=8dcd7074cf15e75859f80d66a2daf132 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-set-default-for-not-null.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=72d58313f3ac0382e5f70df8119862c5 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-set-default-for-not-null.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f548418dedf11ae8597c845e4aa59e19 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-set-default-for-not-null.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=48e4d03b6798c6bc34c4f0e40e19bc16 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-set-default-for-not-null.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=de7855306792c88e93acb9fcb41d5eee 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-36`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if setting default values for NOT NULL columns.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-39`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Support for PostgreSQL is coming soon.`}),`\n`,_jsx(`div`,{id:`column.disallow-change`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-alter-table-change-column-statements`,children:`Disallow ALTER TABLE CHANGE COLUMN statements`}),`\n`,_jsx(_components.p,{children:`CHANGE COLUMN is a MySQL extension to standard SQL. CHANGE COLUMN can change column definition and names, or both.\nMost of the time, you just want to change one of two. So you need to use RENAME COLUMN and MODIFY COLUMN instead of CHANGE COLUMN to avoid unexpected modifications.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-change.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=3f48284227c695e9969394ac1473d46b`,alt:`sql-review-column-disallow-change`,\"data-og-width\":`929`,width:`929`,\"data-og-height\":`350`,height:`350`,\"data-path\":`content/docs/sql-review/sql-review-column-disallow-change.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-change.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=14f03d0b2ad9c477395076165f282790 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-change.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=37e50127a22c0c9504ed51a2a73e1e69 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-change.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5543bbc4dbe07044145c19f6b46f1df9 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-change.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e18b4a5ba5625bd7601101113257a29f 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-change.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=36aa69ed91e9bb8da3e22bb95afa139f 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-change.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=17840e538ef90f89e3c0e434e427d5e3 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-37`,children:`How the rule works`}),`\n`,_jsxs(_components.p,{children:[`Bytebase checks if using `,_jsx(_components.code,{children:`ALTER TABLE CHANGE COLUMN`}),` statements.`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-40`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.disallow-changing-order`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-changing-column-order`,children:`Disallow changing column order`}),`\n`,_jsx(_components.p,{children:`Changing column order may cause performance issues. Users should be cautious about this.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-order.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e825c1b2c56f4ebda5588942a34baf9a`,alt:`sql-review-column-disallow-changing-order`,\"data-og-width\":`921`,width:`921`,\"data-og-height\":`348`,height:`348`,\"data-path\":`content/docs/sql-review/sql-review-column-disallow-changing-order.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-order.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=0cc8a3779ef232defbb22704864ecde6 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-order.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=78f9c1cea89a1e05d32569f8cc13c88a 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-order.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=69ec8fc379196f07d6cd8978a468fadf 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-order.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=6260bb3e0ab2635236cbb56369c49c57 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-order.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=7bb5ca356d963e72f7026a2d930bce6a 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-changing-order.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=30c23a7bd90a2453629246e81123698e 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-38`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if changing column order.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-41`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.auto-increment-must-integer`}),`\n`,_jsx(Heading,{level:`3`,id:`use-integer-for-auto-increment-columns`,children:`Use integer for auto-increment columns`}),`\n`,_jsx(_components.p,{children:`The auto-increment column must be integer.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-integer.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=1b64e5938a4a2481006b073ff38faade`,alt:`sql-review-column-auto-increment-must-integer`,\"data-og-width\":`918`,width:`918`,\"data-og-height\":`362`,height:`362`,\"data-path\":`content/docs/sql-review/sql-review-column-auto-increment-must-integer.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-integer.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=b176a9a10cd28406b18bd29f244d4705 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-integer.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=ae38d26edede53ebd3a5cdaa8d52eb1c 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-integer.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=e009b1f4f4f8c5b4bff6218ea3ccd95e 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-integer.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=7badb86aa4d155c2e93db85b071ccb81 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-integer.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=1d2a39681d1d630b260ce1eea2cf7d11 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-integer.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=b9838715e93efca93cec22149fd4301f 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-39`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the auto-increment column type.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-42`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Support for PostgreSQL is coming soon.`}),`\n`,_jsx(`div`,{id:`column.disallow-set-charset`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-set-charset-for-columns`,children:`Disallow set charset for columns`}),`\n`,_jsx(_components.p,{children:`It’s better to set the charset in the table or database.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-set-charset.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=18a104e7847429a6919b11dd49fe8cbc`,alt:`sql-review-column-disallow-set-charset`,\"data-og-width\":`922`,width:`922`,\"data-og-height\":`365`,height:`365`,\"data-path\":`content/docs/sql-review/sql-review-column-disallow-set-charset.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-set-charset.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=fc24fb704a544e75fa0386e431875074 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-set-charset.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=928424c049931fc654d5cf02a01c5bb7 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-set-charset.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=fe37c5accaedd78d0ff1efc9caa34ada 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-set-charset.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=a0e2cfca0e031f941bc3b012a8632cc9 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-set-charset.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=dc77248f5691d71b5658ac8e72f75a01 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-set-charset.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=075ff62234622fbc582942ba8d185154 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-40`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if setting charset for columns.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-43`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.auto-increment-must-unsigned`}),`\n`,_jsx(Heading,{level:`3`,id:`set-unsigned-attribute-on-auto-increment-columns`,children:`Set unsigned attribute on auto-increment columns`}),`\n`,_jsx(_components.p,{children:`Setting unsigned attribute on auto-increment columns to avoid negative numbers.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-unsigned.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=24fc00dd52f510b1b490add23f2d77e4`,alt:`sql-review-column-auto-increment-must-unsigned`,\"data-og-width\":`923`,width:`923`,\"data-og-height\":`368`,height:`368`,\"data-path\":`content/docs/sql-review/sql-review-column-auto-increment-must-unsigned.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-unsigned.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=dc69bfb0aa10b4a3e6ddd53b6ca66681 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-unsigned.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=10fb40ae896ca53102babbaab8827428 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-unsigned.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=442af3961c1320d4d0c14dabf0646b6d 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-unsigned.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=97dcb6c185a77d3b44845d25b0de20ff 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-unsigned.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=461af2351d21fc48c135379b769f44bc 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-must-unsigned.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=788bf9f50f32e28e1423e1c315f36008 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-41`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the unsigned attribute for auto-increment columns.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-44`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.comment`}),`\n`,_jsx(Heading,{level:`3`,id:`column-comment-convention`,children:`Column comment convention`}),`\n`,_jsx(_components.p,{children:`Configure whether the column requires comments and the maximum comment length.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-comment.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=e73eed8d774d48c04c558e565006ab4f`,alt:`sql-review-column-comment`,\"data-og-width\":`920`,width:`920`,\"data-og-height\":`362`,height:`362`,\"data-path\":`content/docs/sql-review/sql-review-column-comment.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-comment.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=0846bf3db3960921a49a0244eebc2136 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-comment.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=965688fb3aac9809cb1935356d5e3316 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-comment.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=b1a5dbaeba1c3fdc4195a94ab8715a38 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-comment.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=02586a9a2f6ed6264b61cd62f5e2ea4e 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-comment.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=3406f6ad9a45881831dc0db559836e21 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-comment.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=737bc9b4f13c67276625a3a71457562b 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-42`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the column comment.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-45`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.maximum-character-length`}),`\n`,_jsx(Heading,{level:`3`,id:`maximum-char-length`,children:`Maximum CHAR length`}),`\n`,_jsx(_components.p,{children:`The CHAR type is the fixed-length type. A longer CHAR will require more storage space.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-character-length.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=c9f5312af9cd5c90e236222676da3375`,alt:`sql-review-column-maximum-character-length`,\"data-og-width\":`926`,width:`926`,\"data-og-height\":`360`,height:`360`,\"data-path\":`content/docs/sql-review/sql-review-column-maximum-character-length.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-character-length.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=9d1e4ba9b0af78733be3f98712567e22 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-character-length.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=cce25e1798d2c0be8853cadd15c82328 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-character-length.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=1dac0710c883067f9c521a35407e935e 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-character-length.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=b14d51dec4ce34bea05d17bcd2ebf4cf 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-character-length.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=07a7b5e139c9183c8f101e8842cbfa53 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-character-length.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=d2d6acd207bb763cf7e3ebdb4c100d56 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-43`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the length for the CHAR type.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-46`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.maximum-varchar-length`}),`\n`,_jsx(Heading,{level:`3`,id:`maximum-varchar-length`,children:`Maximum VARCHAR length`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-varchar-length.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=0faebece40d8e472a42db59bc65b635b`,alt:`sql-review-column-maximum-varchar-length`,\"data-og-width\":`1818`,width:`1818`,\"data-og-height\":`644`,height:`644`,\"data-path\":`content/docs/sql-review/sql-review-column-maximum-varchar-length.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-varchar-length.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=b3fd571ae1fd8ecb2f2ecafd6dc5950d 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-varchar-length.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=1d8191319324f1ff83764314ccda62aa 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-varchar-length.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=b40e4b944c782ff0937d20d45ff3f391 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-varchar-length.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e62b4e27e164d74af445f78418c25d44 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-varchar-length.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=29291836f516b43eeb72926b958f3c29 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-maximum-varchar-length.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=51a0cee1b8b8818a45258a2e7bdf42fd 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-44`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the length for the VARCHAR type.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-47`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`Snowflake`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.auto-increment-initial-value`}),`\n`,_jsx(Heading,{level:`3`,id:`auto-increment-initial-value`,children:`Auto-increment initial value`}),`\n`,_jsx(_components.p,{children:`Set initial value for auto-increment columns.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-initial-value.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=ba1023fd50f0a35ba99610b73de6f628`,alt:`sql-review-column-auto-increment-initial-value`,\"data-og-width\":`923`,width:`923`,\"data-og-height\":`362`,height:`362`,\"data-path\":`content/docs/sql-review/sql-review-column-auto-increment-initial-value.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-initial-value.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=c1a4c9e1511d17f115ef2e6268c77965 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-initial-value.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=a0630f0f8dcf0e6bfc76be1a5e7f5360 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-initial-value.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=68d07ab1c6ab938cee74fcc62361fb04 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-initial-value.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=5f1c9d4c4c679c2ae8d00265dd4dd4a6 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-initial-value.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=e44f49e4baf40dcade6d2965eb1650dd 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-auto-increment-initial-value.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=268dbcbc661d78e018d968c771ed97d2 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-45`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the initial value for auto-increment columns.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-48`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.current-time-count-limit`}),`\n`,_jsx(Heading,{level:`3`,id:`limit-the-count-of-current-time-columns`,children:`Limit the count of current time columns`}),`\n`,_jsxs(_components.p,{children:[`Limit the count of `,_jsx(_components.code,{children:`NOW()`}),`, `,_jsx(_components.code,{children:`CURRENT_TIME()`}),` and `,_jsx(_components.code,{children:`CURRENT_TIMESTAMP()`}),` columns.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-current-time-count-limit.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=6187666ccdba2dd8a47ae06cc8004c85`,alt:`sql-review-column-current-time-count-limit`,\"data-og-width\":`928`,width:`928`,\"data-og-height\":`367`,height:`367`,\"data-path\":`content/docs/sql-review/sql-review-column-current-time-count-limit.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-current-time-count-limit.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=1106951e6bc42dfbb52707c263708155 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-current-time-count-limit.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=1faa9f29a79206ca44e871504c8a967e 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-current-time-count-limit.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=d49c49c8e116f52c5dc503e850e2b51c 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-current-time-count-limit.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=716d018ef0bb99522eb02cd3f5faf202 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-current-time-count-limit.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=a723bcd9151fa805e4d9a073f5d4a92c 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-current-time-count-limit.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=9248f78c76fa9b98129da39a3895b06b 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-46`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`This rule will count the two types of the columns:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`the column with default current time , such as `,_jsx(_components.code,{children:`DEFAULT NOW()`})]}),`\n`,_jsxs(_components.li,{children:[`the column with ON UPDATE current time, such as `,_jsx(_components.code,{children:`ON UPDATE NOW()`})]}),`\n`]}),`\n`,_jsx(_components.p,{children:`If the count of type one columns is more than two or the count of type two columns is more than one, this rule will alert users.`}),`\n`,_jsx(_components.p,{children:`The meaning of the number is:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`A table usually has `,_jsx(_components.code,{children:`created_ts`}),` and `,_jsx(_components.code,{children:`updated_ts`}),` column with `,_jsx(_components.code,{children:`DEFAULT NOW()`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`A table usually has `,_jsx(_components.code,{children:`updated_ts`}),` column with `,_jsx(_components.code,{children:`ON UPDATE NOW()`})]}),`\n`]}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-49`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.require-default`}),`\n`,_jsx(Heading,{level:`3`,id:`require-column-default-value`,children:`Require column default value`}),`\n`,_jsx(_components.p,{children:`Require default value for all columns, except PRIMARY KEY, JSON, BLOB, TEXT, GEOMETRY, AUTO_INCREMENT, GENERATED columns.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-require-default.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=4edf250f52a8dbdbde7d16a0e55a24dd`,alt:`sql-review-column-require-default`,\"data-og-width\":`924`,width:`924`,\"data-og-height\":`365`,height:`365`,\"data-path\":`content/docs/sql-review/sql-review-column-require-default.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-require-default.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=199f6b5de73a5ede48257798a6bd1ebe 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-require-default.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=716132346affe159c07eb01935071e81 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-require-default.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=ad14b5498330e4d10b9c89ff227f1b19 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-require-default.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=ef5e5995d76a08dfa9a46447a57e393f 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-require-default.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=3c6d0137c6ba1c7face7642913d881a4 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-require-default.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=a2d47b58dbfd8da14d3937887971e902 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-47`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the column default value.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-50`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.disallow-drop-in-index`}),`\n`,_jsx(Heading,{level:`3`,id:`prohibit-dropping-columns-in-indexes`,children:`Prohibit dropping columns in indexes`}),`\n`,_jsx(_components.p,{children:`Dropping columns in indexes may cause performance issues. Users should be cautious about this.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-drop-in-index.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=d497af9a1851dc761623b991d5f8d02e`,alt:`sql-review-column-disallow-drop-in-index`,\"data-og-width\":`1864`,width:`1864`,\"data-og-height\":`432`,height:`432`,\"data-path\":`content/docs/sql-review/sql-review-column-disallow-drop-in-index.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-drop-in-index.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=8b97f77e8bafc76bf697f6e55e52b0c2 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-drop-in-index.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=c0c4597cc5b9e202f681b2c0f8c60341 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-drop-in-index.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=37571eac3796b3a988c6bdfd3b18b908 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-drop-in-index.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=75413d0e47a549096616a7d8a1a9ca3a 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-drop-in-index.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5ddcb27773155d3728fa16e5aa6e8c8c 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-column-disallow-drop-in-index.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=af39b424628aeccc71fb254788907062 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-48`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if dropping columns in indexes.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE DROP COLUMN`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-51`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`column.default-disallow-volatile`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-setting-volatile-default-value-on-columns`,children:`Disallow setting volatile default value on columns`}),`\n`,_jsxs(_components.p,{children:[`Volatile functions, such as `,_jsx(_components.code,{children:`clock_timestamp()`}),`, update each row with the value at the time of `,_jsx(_components.code,{children:`ALTER TABLE ADD COLUMN`}),` execution. This can lead to lengthy updates and potential performance issues.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-default-disallow-volatile.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=d2d7f47aeb6660b1746dd6632c893551`,alt:`sql-review-column-default-disallow-volatile`,\"data-og-width\":`1540`,width:`1540`,\"data-og-height\":`502`,height:`502`,\"data-path\":`content/docs/sql-review/sql-review-column-default-disallow-volatile.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-default-disallow-volatile.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=10c7855d9df025fbbfe7dd095a40ce2f 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-default-disallow-volatile.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=99992ba6c871b14e0d260e39fa921b57 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-default-disallow-volatile.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=b95bd1526bd718da212edace4b00abfa 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-default-disallow-volatile.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=39dc9e77bcaaa43ca4aadcf735a9342c 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-default-disallow-volatile.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=40d8e161e5d8c1fb796b24ed335c03d9 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/sql-review-column-default-disallow-volatile.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=09c220ec219d916ad99834113ab50981 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-49`,children:`How the rule works`}),`\n`,_jsxs(_components.p,{children:[`Bytebase checks if the default value of columns is volatile in `,_jsx(_components.code,{children:`ALTER TABLE ADD COLUMN`}),` statements.`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-52`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`index`,children:`Index`}),`\n`,_jsx(`div`,{id:`index.no-duplicate-column`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-duplicate-column-in-index-keys`,children:`Disallow duplicate column in index keys`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-no-duplicate-column.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=ed5c1fd2a9b2f7f7912c94dbaba06b26`,alt:`sql-review-index-no-duplicate-column`,\"data-og-width\":`914`,width:`914`,\"data-og-height\":`363`,height:`363`,\"data-path\":`content/docs/sql-review/sql-review-index-no-duplicate-column.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-no-duplicate-column.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=34ef3d43a76949ee0c289f3da9579cf9 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-no-duplicate-column.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=5861540137fb2ff49120e229fc85806f 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-no-duplicate-column.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=4d5e6d69c7629d694259122b233bcf6e 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-no-duplicate-column.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f6aa7a44d62580ea31fd9b3ff41ecd40 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-no-duplicate-column.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=638ba245b540515cd2ab5621ee0ce065 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-no-duplicate-column.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=249f1d369b76b3acda8b4fa9f2ea5cf2 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-50`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if there exists duplicate column in index keys.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE INDEX`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-53`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`index.key-number-limit`}),`\n`,_jsx(Heading,{level:`3`,id:`limit-the-count-of-index-keys`,children:`Limit the count of index keys`}),`\n`,_jsx(_components.p,{children:`Limit the count of index keys in one index.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-key-number-limit.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=1550ba9606584d19724208298e903325`,alt:`sql-review-index-key-number-limit`,\"data-og-width\":`918`,width:`918`,\"data-og-height\":`363`,height:`363`,\"data-path\":`content/docs/sql-review/sql-review-index-key-number-limit.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-key-number-limit.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=835444e0415983c9f20cc4dc5aa8631d 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-key-number-limit.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=95c8c464363e12054b83beea0f8d212e 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-key-number-limit.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=abb6167a568815f448ad247a6a8fd7ee 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-key-number-limit.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=d1ff7ab3aa14aa1926d04fe3f7dff62a 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-key-number-limit.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=a46ba11048c40c4d326f323eb286ebad 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-key-number-limit.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=eb0d7167c1e88e067ce842eabe5e0349 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-51`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the count of index keys in each index.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE INDEX`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-54`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`Oracle`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`index.pk-type-limit`}),`\n`,_jsx(Heading,{level:`3`,id:`limit-key-type-for-primary-keys`,children:`Limit key type for primary keys`}),`\n`,_jsx(_components.p,{children:`Alert users if key type is not INT or BIGINT in primary keys.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-pk-type-limit.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=2efca01d1a15e7b84de0672b30b3a693`,alt:`sql-review-index-pk-type-limit`,\"data-og-width\":`920`,width:`920`,\"data-og-height\":`369`,height:`369`,\"data-path\":`content/docs/sql-review/sql-review-index-pk-type-limit.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-pk-type-limit.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=25c0a1f86a3d27fb372f2092134f16fe 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-pk-type-limit.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=8a6ce533990eb323c0dd0700e321cf85 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-pk-type-limit.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=bce484ac5da12c258cca87f44d0ed304 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-pk-type-limit.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=96b97505c5cb625d70667aee8211d6bb 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-pk-type-limit.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=d3db6a42a2e84e9cd10bd88aeda24e4a 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-pk-type-limit.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=fa0e2c093c72456aea29476553db7a06 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-52`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the key type for primary keys.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-55`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Support for PostgreSQL is coming soon.`}),`\n`,_jsx(`div`,{id:`index.type-no-blob`}),`\n`,_jsx(Heading,{level:`3`,id:`disallow-blob-and-text-for-index-keys`,children:`Disallow BLOB and TEXT for index keys`}),`\n`,_jsx(_components.p,{children:`Disallow using BLOB and TEXT type as index keys.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-disallow-blob.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=fc63653da59c2a3feeb4eaf223173902`,alt:`sql-review-index-type-no-blob`,\"data-og-width\":`916`,width:`916`,\"data-og-height\":`347`,height:`347`,\"data-path\":`content/docs/sql-review/sql-review-index-disallow-blob.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-disallow-blob.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=8fbda8378838426dc83b8c68a151048e 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-disallow-blob.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=3f47375607de14931802361cb07428fd 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-disallow-blob.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=aa7e469f5a8f57f9a35b9608f7a91e37 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-disallow-blob.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=224143b18ef305d8b58473dc756d40b4 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-disallow-blob.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f32ef4c2070cb79e8a385c8353680ae5 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-disallow-blob.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=2bb91c3105242a4992c161038f5ae206 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-53`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the key type for index keys.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE INDEX`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-56`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Support for PostgreSQL is coming soon.`}),`\n`,_jsx(`div`,{id:`index.total-number-limit`}),`\n`,_jsx(Heading,{level:`3`,id:`index-count-limit`,children:`Index count limit`}),`\n`,_jsx(_components.p,{children:`Limit the index count in one table.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-total-number-limit.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=b22884e96c671e7a6b506d0341460fed`,alt:`sql-review-index-total-number-limit`,\"data-og-width\":`924`,width:`924`,\"data-og-height\":`369`,height:`369`,\"data-path\":`content/docs/sql-review/sql-review-index-total-number-limit.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-total-number-limit.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=919aec9349630082b5ef46adbbce9b8d 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-total-number-limit.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=428deb31a50c37b839a7e174f3ea213a 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-total-number-limit.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=fd1a71d73b02a0f0f66ed27607234d99 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-total-number-limit.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=50508223ba1d781678d0ff07a97e8d46 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-total-number-limit.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=c397a51915703b06d4d572bec6c13049 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-total-number-limit.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f65cf85f845761a9378925265df53d6a 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-54`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the index count for each table.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE INDEX`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-57`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`index.primary-key-type-allowlist`}),`\n`,_jsx(Heading,{level:`3`,id:`primary-key-type-allowlist`,children:`Primary key type allowlist`}),`\n`,_jsx(_components.p,{children:`Limit the data type for primary key.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-primary-key-type-allowlist.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=42adb5d762b221938b274159f072cf92`,alt:`sql-review-index-primary-key-type-allowlist`,\"data-og-width\":`1446`,width:`1446`,\"data-og-height\":`628`,height:`628`,\"data-path\":`content/docs/sql-review/sql-review-index-primary-key-type-allowlist.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-primary-key-type-allowlist.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f1727e560897c108933d595513664735 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-primary-key-type-allowlist.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=806e10c9971ccf60f7626b7c0df61921 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-primary-key-type-allowlist.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e1f818c1977b49c75dda139460b5d7dd 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-primary-key-type-allowlist.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e7c6dcf0686ee6b515dbbfed725f9d28 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-primary-key-type-allowlist.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=0d69f9f2f8a443d0806c7309370a66a3 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-primary-key-type-allowlist.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=4009a0460a501b2f4e536642cc9fef7b 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-55`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks the data type for each primary key.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE ADD CONSTRAINT`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-58`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`index.create-concurrently`}),`\n`,_jsx(Heading,{level:`3`,id:`create-index-concurrently`,children:`Create index concurrently`}),`\n`,_jsx(_components.p,{children:`Creating indexes blocks writes (but not reads) on the table until it’s done. Use CONCURRENTLY when creates indexes can allow writes to continue.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-create-concurrently.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=865fd0bd4363e947c295b6f520d259a6`,alt:`sql-review-index-create-concurrently`,\"data-og-width\":`1628`,width:`1628`,\"data-og-height\":`648`,height:`648`,\"data-path\":`content/docs/sql-review/sql-review-index-create-concurrently.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-create-concurrently.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=9e5f65be6ff72564bb98e4b55060dbaa 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-create-concurrently.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=191780fb096affafa1777c9890f7fc49 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-create-concurrently.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=6c8fc4140d9180ab54970994ee36d9d0 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-create-concurrently.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=b6c8dc9095753f51819ef3926d5c2d8a 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-create-concurrently.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f6c08d24ee2579ae921255b42de6c510 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-index-create-concurrently.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=87c68ae16b8c0de40c0c7601c9b502c6 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-56`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE INDEX`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-59`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`database`,children:`Database`}),`\n`,_jsx(`div`,{id:`database.drop-empty-database`}),`\n`,_jsx(Heading,{level:`3`,id:`drop-database-restriction`,children:`Drop database restriction`}),`\n`,_jsx(_components.p,{children:`Can only drop the database if there’s no table in it.\nIt requires users to drop all containing tables first before dropping the database.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-drop-empty-db.webp?fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=45b9fb01bec33255f50fba34a7fae2d8`,alt:`schema-review-drop-empty-db`,\"data-og-width\":`1984`,width:`1984`,\"data-og-height\":`1000`,height:`1000`,\"data-path\":`content/docs/sql-review/schema-review-drop-empty-db.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-drop-empty-db.webp?w=280\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=46127f9a1bc54ad4caffb08edfffb0c7 280w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-drop-empty-db.webp?w=560\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=2f7799a0bbe49e9a9978ee0f3752a603 560w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-drop-empty-db.webp?w=840\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=77732cfbb0f2151c2aaf44ffa2d2df75 840w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-drop-empty-db.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=0852f3d088b3eaaa33148c1352ab6770 1100w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-drop-empty-db.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=65140da2b0c4e3636fd2b900e223b0ac 1650w, https://mintcdn.com/dbx/oPldGQC4HFcCc-EY/content/docs/sql-review/schema-review-drop-empty-db.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=oPldGQC4HFcCc-EY\u0026q=85\u0026s=2296864bf655703c8ec69a1a30000984 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-57`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if there exists any table in the specific database.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`DROP DATABASE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-60`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Support for PostgreSQL is coming soon.`}),`\n`,_jsx(Heading,{level:`2`,id:`system`,children:`System`}),`\n`,_jsx(`div`,{id:`system.charset.allowlist`}),`\n`,_jsx(Heading,{level:`3`,id:`charset-allow-list`,children:`Charset allow list`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-charset-allow-list.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=99cb28caa6a8cead2e8f2eefa2ab8402`,alt:`sql-review-system-charset-allowlist`,\"data-og-width\":`919`,width:`919`,\"data-og-height\":`363`,height:`363`,\"data-path\":`content/docs/sql-review/sql-review-system-charset-allow-list.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-charset-allow-list.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=56215d555bff5df1a8275480c9917482 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-charset-allow-list.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=a837259cb2d76d9add0350bab6d7e8f2 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-charset-allow-list.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=44d2596ff3a866c70a614f547a5f0c35 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-charset-allow-list.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=ed4f2a5e61922a3578403ae6b6428793 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-charset-allow-list.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=1016cb138a1ed953e7f07a68734970c2 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-charset-allow-list.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=42d0da1a885ee38d914637f0adf30bd2 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-58`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if the SQL statement uses the charset outside of the allow list.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-61`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`system.collation.allowlist`}),`\n`,_jsx(Heading,{level:`3`,id:`collation-allow-list`,children:`Collation allow list`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-collation-allowlist.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=2cf5334eb9978250dac12bbfc6f308ff`,alt:`sql-review-system-collation-allowlist`,\"data-og-width\":`918`,width:`918`,\"data-og-height\":`364`,height:`364`,\"data-path\":`content/docs/sql-review/sql-review-system-collation-allowlist.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-collation-allowlist.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=e26d7061e3a1891c734e01d2fde0a4ef 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-collation-allowlist.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=f5a4b5b89626fd7bae9a9a3e87fdb485 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-collation-allowlist.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=78a94dc4d6db884e1402a3a22b14bb47 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-collation-allowlist.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=b2107ceb49d92416c920d809077a4d8a 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-collation-allowlist.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=42c2439cb8a59b8334979929811d2fc8 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-collation-allowlist.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=465d3c51f7799353ca01f2dddfd5d877 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-59`,children:`How the rule works`}),`\n`,_jsx(_components.p,{children:`Bytebase checks if the SQL statement uses the collation outside of the allow list.`}),`\n`,_jsx(_components.p,{children:`Specifically, Bytebase checks:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`CREATE TABLE`}),` statements`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`ALTER TABLE`}),` statements`]}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-62`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`MySQL`}),`\n`,_jsx(_components.li,{children:`TiDB`}),`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`,_jsx(_components.li,{children:`OceanBase`}),`\n`]}),`\n`,_jsx(`div`,{id:`system.comment.length`}),`\n`,_jsx(Heading,{level:`3`,id:`comment-length-limit`,children:`Comment length limit`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-comment-length.webp?fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=4c7e562603489634480e671e61e9ccb8`,alt:`sql-review-system-comment-length`,\"data-og-width\":`1828`,width:`1828`,\"data-og-height\":`642`,height:`642`,\"data-path\":`content/docs/sql-review/sql-review-system-comment-length.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-comment-length.webp?w=280\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=2a60c3e3177b2c75e71fa713d70b531f 280w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-comment-length.webp?w=560\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=24c4dd2608ca390b48b08fc4d744f0e7 560w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-comment-length.webp?w=840\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=bcf039a18579c7ac907949ddc0fb9df9 840w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-comment-length.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=8aacb813de9299048c011c097dd6cb22 1100w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-comment-length.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=9c884b3db8194373b9a02b16a7d96ec4 1650w, https://mintcdn.com/dbx/8Z2Tpw0PfCAhTKDg/content/docs/sql-review/sql-review-system-comment-length.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=8Z2Tpw0PfCAhTKDg\u0026q=85\u0026s=ca30d553807190f68ab18acf26a1d94f 2500w`}),`\n`,_jsx(Heading,{level:`4`,id:`how-the-rule-works-60`,children:`How the rule works`}),`\n`,_jsxs(_components.p,{children:[`Bytebase checks all `,_jsx(_components.code,{children:`COMMENT ON`}),` statements.`]}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-63`,children:`Support database engine`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`PostgreSQL`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`built-in-rules`,children:`Built-in rules`}),`\n`,_jsx(`div`,{id:`builtin.prior-backup-check`}),`\n`,_jsx(Heading,{level:`3`,id:`prior-backup-feasibility-check`,children:`Prior backup feasibility check`}),`\n`,_jsxs(_components.p,{children:[`Check `,_jsx(_components.a,{href:`/change-database/rollback-data-changes`,children:`Data Rollback`}),` for details.`]}),`\n`,_jsx(`div`,{id:`builtin.statement.maximum-sql-size`}),`\n`,_jsx(Heading,{level:`3`,id:`restrict-the-sql-file-size`,children:`Restrict the SQL file size`}),`\n`,_jsx(_components.p,{children:`Rejects a change whose SQL is larger than the configured size. The default is 2 MB.`}),`\n`,_jsx(Heading,{level:`4`,id:`support-database-engine-64`,children:`Support database engine`}),`\n`,_jsx(_components.p,{children:`Every engine that supports SQL review.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Review Rules","description":null,"href":"/sql-review/review-rules"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Supported rules","slug":"supported-rules","depth":2,"children":[]},{"title":"Engine","slug":"engine","depth":2,"children":[{"title":"Require InnoDB","slug":"require-innodb","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine","depth":4,"children":[]}]},{"title":"Naming","slug":"naming","depth":2,"children":[{"title":"Fully qualified object name","slug":"fully-qualified-object-name","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-2","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-2","depth":4,"children":[]},{"title":"Table naming convention","slug":"table-naming-convention","depth":3,"children":[]},{"title":"About convention format","slug":"about-convention-format","depth":4,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-3","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-3","depth":4,"children":[]},{"title":"Column naming convention","slug":"column-naming-convention","depth":3,"children":[]},{"title":"About convention format","slug":"about-convention-format-2","depth":4,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-4","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-4","depth":4,"children":[]},{"title":"Auto-increment column naming convention","slug":"auto-increment-column-naming-convention","depth":3,"children":[]},{"title":"About convention format","slug":"about-convention-format-3","depth":4,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-5","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-5","depth":4,"children":[]},{"title":"Index naming convention","slug":"index-naming-convention","depth":3,"children":[]},{"title":"About convention format","slug":"about-convention-format-4","depth":4,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-6","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-6","depth":4,"children":[]},{"title":"Primary key naming convention","slug":"primary-key-naming-convention","depth":3,"children":[]},{"title":"About convention format","slug":"about-convention-format-5","depth":4,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-7","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-7","depth":4,"children":[]},{"title":"Unique key naming convention","slug":"unique-key-naming-convention","depth":3,"children":[]},{"title":"About convention format","slug":"about-convention-format-6","depth":4,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-8","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-8","depth":4,"children":[]},{"title":"Foreign key naming convention","slug":"foreign-key-naming-convention","depth":3,"children":[]},{"title":"About convention format","slug":"about-convention-format-7","depth":4,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-9","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-9","depth":4,"children":[]},{"title":"Disallow keywords as table names","slug":"disallow-keywords-as-table-names","depth":3,"children":[]},{"title":"Support database engine","slug":"support-database-engine-10","depth":4,"children":[]},{"title":"Disallow keywords as identifiers","slug":"disallow-keywords-as-identifiers","depth":3,"children":[]},{"title":"Support database engine","slug":"support-database-engine-11","depth":4,"children":[]},{"title":"Identifier case","slug":"identifier-case","depth":3,"children":[]},{"title":"Support database engine","slug":"support-database-engine-12","depth":4,"children":[]}]},{"title":"Statement","slug":"statement","depth":2,"children":[{"title":"Disallow SELECT *","slug":"disallow-select","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-10","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-13","depth":4,"children":[]},{"title":"Require WHERE","slug":"require-where","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-11","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-14","depth":4,"children":[]},{"title":"Disallow leading % in LIKE","slug":"disallow-leading-%-in-like","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-12","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-15","depth":4,"children":[]},{"title":"Disallow COMMIT","slug":"disallow-commit","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-13","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-16","depth":4,"children":[]},{"title":"Disallow LIMIT","slug":"disallow-limit","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-14","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-17","depth":4,"children":[]},{"title":"Disallow ORDER BY","slug":"disallow-order-by","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-15","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-18","depth":4,"children":[]},{"title":"Merge ALTER TABLE","slug":"merge-alter-table","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-16","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-19","depth":4,"children":[]},{"title":"INSERT statements must specify columns","slug":"insert-statements-must-specify-columns","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-17","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-20","depth":4,"children":[]},{"title":"Disallow ORDER BY RAND in INSERT statements","slug":"disallow-order-by-rand-in-insert-statements","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-18","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-21","depth":4,"children":[]},{"title":"Limit the inserted rows","slug":"limit-the-inserted-rows","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-19","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-22","depth":4,"children":[]},{"title":"Limit affected row limit","slug":"limit-affected-row-limit","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-20","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-23","depth":4,"children":[]},{"title":"Dry run DML statements","slug":"dry-run-dml-statements","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-21","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-24","depth":4,"children":[]},{"title":"Disallow add column with default","slug":"disallow-add-column-with-default","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-22","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-25","depth":4,"children":[]},{"title":"Add CHECK constraints with NOT VALID option","slug":"add-check-constraints-with-not-valid-option","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-23","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-26","depth":4,"children":[]},{"title":"Disallow add NOT NULL constraints to an existing column","slug":"disallow-add-not-null-constraints-to-an-existing-column","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-24","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-27","depth":4,"children":[]}]},{"title":"Table","slug":"table","depth":2,"children":[{"title":"Limit DDL operations on tables with large data volumes","slug":"limit-ddl-operations-on-tables-with-large-data-volumes","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-25","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-28","depth":4,"children":[]},{"title":"Require primary key","slug":"require-primary-key","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-26","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-29","depth":4,"children":[]},{"title":"Disallow foreign key","slug":"disallow-foreign-key","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-27","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-30","depth":4,"children":[]},{"title":"Drop naming convention","slug":"drop-naming-convention","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-28","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-31","depth":4,"children":[]},{"title":"Disallow partition table","slug":"disallow-partition-table","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-29","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-32","depth":4,"children":[]},{"title":"Table comment convention","slug":"table-comment-convention","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-30","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-33","depth":4,"children":[]}]},{"title":"Schema","slug":"schema","depth":2,"children":[{"title":"Backward incompatible schema change","slug":"backward-incompatible-schema-change","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-31","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-34","depth":4,"children":[]}]},{"title":"Column","slug":"column","depth":2,"children":[{"title":"Enforce the required columns in each table","slug":"enforce-the-required-columns-in-each-table","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-32","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-35","depth":4,"children":[]},{"title":"Column type disallow list","slug":"column-type-disallow-list","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-33","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-36","depth":4,"children":[]},{"title":"Columns no NULL value","slug":"columns-no-null-value","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-34","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-37","depth":4,"children":[]},{"title":"Disallow changing column type","slug":"disallow-changing-column-type","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-35","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-38","depth":4,"children":[]},{"title":"Set DEFAULT value for NOT NULL columns","slug":"set-default-value-for-not-null-columns","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-36","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-39","depth":4,"children":[]},{"title":"Disallow ALTER TABLE CHANGE COLUMN statements","slug":"disallow-alter-table-change-column-statements","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-37","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-40","depth":4,"children":[]},{"title":"Disallow changing column order","slug":"disallow-changing-column-order","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-38","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-41","depth":4,"children":[]},{"title":"Use integer for auto-increment columns","slug":"use-integer-for-auto-increment-columns","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-39","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-42","depth":4,"children":[]},{"title":"Disallow set charset for columns","slug":"disallow-set-charset-for-columns","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-40","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-43","depth":4,"children":[]},{"title":"Set unsigned attribute on auto-increment columns","slug":"set-unsigned-attribute-on-auto-increment-columns","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-41","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-44","depth":4,"children":[]},{"title":"Column comment convention","slug":"column-comment-convention","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-42","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-45","depth":4,"children":[]},{"title":"Maximum CHAR length","slug":"maximum-char-length","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-43","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-46","depth":4,"children":[]},{"title":"Maximum VARCHAR length","slug":"maximum-varchar-length","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-44","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-47","depth":4,"children":[]},{"title":"Auto-increment initial value","slug":"auto-increment-initial-value","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-45","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-48","depth":4,"children":[]},{"title":"Limit the count of current time columns","slug":"limit-the-count-of-current-time-columns","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-46","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-49","depth":4,"children":[]},{"title":"Require column default value","slug":"require-column-default-value","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-47","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-50","depth":4,"children":[]},{"title":"Prohibit dropping columns in indexes","slug":"prohibit-dropping-columns-in-indexes","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-48","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-51","depth":4,"children":[]},{"title":"Disallow setting volatile default value on columns","slug":"disallow-setting-volatile-default-value-on-columns","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-49","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-52","depth":4,"children":[]}]},{"title":"Index","slug":"index","depth":2,"children":[{"title":"Disallow duplicate column in index keys","slug":"disallow-duplicate-column-in-index-keys","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-50","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-53","depth":4,"children":[]},{"title":"Limit the count of index keys","slug":"limit-the-count-of-index-keys","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-51","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-54","depth":4,"children":[]},{"title":"Limit key type for primary keys","slug":"limit-key-type-for-primary-keys","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-52","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-55","depth":4,"children":[]},{"title":"Disallow BLOB and TEXT for index keys","slug":"disallow-blob-and-text-for-index-keys","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-53","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-56","depth":4,"children":[]},{"title":"Index count limit","slug":"index-count-limit","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-54","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-57","depth":4,"children":[]},{"title":"Primary key type allowlist","slug":"primary-key-type-allowlist","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-55","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-58","depth":4,"children":[]},{"title":"Create index concurrently","slug":"create-index-concurrently","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-56","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-59","depth":4,"children":[]}]},{"title":"Database","slug":"database","depth":2,"children":[{"title":"Drop database restriction","slug":"drop-database-restriction","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-57","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-60","depth":4,"children":[]}]},{"title":"System","slug":"system","depth":2,"children":[{"title":"Charset allow list","slug":"charset-allow-list","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-58","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-61","depth":4,"children":[]},{"title":"Collation allow list","slug":"collation-allow-list","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-59","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-62","depth":4,"children":[]},{"title":"Comment length limit","slug":"comment-length-limit","depth":3,"children":[]},{"title":"How the rule works","slug":"how-the-rule-works-60","depth":4,"children":[]},{"title":"Support database engine","slug":"support-database-engine-63","depth":4,"children":[]}]},{"title":"Built-in rules","slug":"built-in-rules","depth":2,"children":[{"title":"Prior backup feasibility check","slug":"prior-backup-feasibility-check","depth":3,"children":[]},{"title":"Restrict the SQL file size","slug":"restrict-the-sql-file-size","depth":3,"children":[]},{"title":"Support database engine","slug":"support-database-engine-64","depth":4,"children":[]}]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/dbx/9053740759cb8dde/demo-embed.js"],"subdomain":"dbx","siteName":"Bytebase Docs","title":"Review Rules - Bytebase Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-05T14:37:41.789Z","originalFileLocation":"sql-review/review-rules.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Bytebase Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/dbx/R2-p_QktkMNyxiB0/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/dbx/R2-p_QktkMNyxiB0/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/dbx/R2-p_QktkMNyxiB0/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/dbx/R2-p_QktkMNyxiB0/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/dbx/R2-p_QktkMNyxiB0/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/dbx/R2-p_QktkMNyxiB0/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/dbx/R2-p_QktkMNyxiB0/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/dbx/R2-p_QktkMNyxiB0/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/dbx/R2-p_QktkMNyxiB0/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Review Rules - Bytebase Docs\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Bytebase Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.bytebase.com/sql-review/review-rules\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://dbx.mintlify.site/_mintlify/api/og/v2?division=Appendix\u0026amp;title=Review+Rules\u0026amp;theme=83d7e50c9104a5d993880fba\u0026amp;signature=80916d836df2ce63d254d85aafa08449abf4bef525e907b8c072b2667a80c093\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Review Rules - Bytebase Docs\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://dbx.mintlify.site/_mintlify/api/og/v2?division=Appendix\u0026amp;title=Review+Rules\u0026amp;theme=83d7e50c9104a5d993880fba\u0026amp;signature=80916d836df2ce63d254d85aafa08449abf4bef525e907b8c072b2667a80c093\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/dbx/R2-p_QktkMNyxiB0/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Bytebase Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2b66ff\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.bytebase.com/sql-review/review-rules\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sql-review/review-rules.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.bytebase.com/#organization\",\"name\":\"Bytebase Docs\",\"url\":\"https://docs.bytebase.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/dbx/vw8BbfZhlW9y-cr_/images/logo/logo-full.png?fit=max\u0026auto=format\u0026n=vw8BbfZhlW9y-cr_\u0026q=85\u0026s=894c5021793b82b6bcef8b09cef3d85d\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.bytebase.com#website\",\"name\":\"Bytebase Docs\",\"url\":\"https://docs.bytebase.com\",\"publisher\":{\"@id\":\"https://docs.bytebase.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.bytebase.com/sql-review/review-rules#webpage\",\"url\":\"https://docs.bytebase.com/sql-review/review-rules\",\"name\":\"Review Rules\",\"dateModified\":\"2026-11-05T14:37:41.789Z\",\"isPartOf\":{\"@id\":\"https://docs.bytebase.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.bytebase.com/sql-review/review-rules#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.bytebase.com/sql-review/review-rules#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Bytebase Docs\",\"item\":\"https://docs.bytebase.com\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Review Rules\",\"item\":\"https://docs.bytebase.com/sql-review/review-rules\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.bytebase.com/sql-review/review-rules#article\",\"headline\":\"Review Rules\",\"name\":\"Review Rules\",\"url\":\"https://docs.bytebase.com/sql-review/review-rules\",\"mainEntityOfPage\":{\"@id\":\"https://docs.bytebase.com/sql-review/review-rules#webpage\"},\"dateModified\":\"2026-11-05T14:37:41.789Z\",\"publisher\":{\"@id\":\"https://docs.bytebase.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.bytebase.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Bytebase Docs\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Bytebase Docs","nav":{"global":{"anchors":[]},"tabs":[{"tab":"Get Started","pages":[{"title":"Get Started","href":"/introduction/what-is-bytebase"}]},{"tab":"Change Management","groups":[{"group":"Database CI/CD","pages":[{"title":"Overview","href":"/change-database/change-workflow"},{"title":"SQL Review Policy","href":"/sql-review/review-policy"},{"title":"Changelog","href":"/change-database/change-history"},{"title":"Webhook","href":"/change-database/webhook"},{"title":"Settings","href":"/change-database/settings"}]},{"group":"UI-Driven Workflow","pages":[{"title":"Overview","href":"/change-database/overview"},{"title":"First Schema Change in 5 Minutes","href":"/tutorials/first-schema-change"},{"group":"Change","pages":[{"title":"Plan","href":"/change-database/plan"},{"title":"Batch Change","href":"/change-database/batch-change"},{"title":"Schema Synchronization","href":"/change-database/synchronize-schema"},{"title":"Online Schema Migration for MySQL","href":"/change-database/online-schema-migration-for-mysql"},{"title":"Transaction Mode","href":"/change-database/transaction-mode"},{"title":"Schema Editor","href":"/change-database/schema-editor"}]},{"title":"Review","href":"/change-database/review"},{"group":"Approval","pages":[{"title":"Custom Approval","href":"/change-database/approval"},{"title":"Risk Center","href":"/administration/risks"}]},{"group":"Rollout","pages":[{"title":"Rollout Permissions","href":"/change-database/environment-policy/rollout-policy"},{"title":"Scheduled Rollout","href":"/change-database/scheduled-rollout"}]},{"group":"Rollback","pages":[{"title":"Data Rollback","href":"/change-database/rollback-data-changes"},{"title":"Schema Rollback","href":"/change-database/rollback-schema-changes"}]}]},{"group":"GitOps Workflow","pages":[{"title":"Overview","href":"/gitops/overview"},{"title":"Installation","href":"/gitops/installation"},{"group":"Migration-Based Workflow","pages":[{"title":"Overview","href":"/gitops/migration-based-workflow/overview"},{"title":"Change a Database with GitOps","sidebarTitle":"Walkthrough","href":"/gitops/migration-based-workflow/tutorial"},{"title":"Develop","href":"/gitops/migration-based-workflow/develop"},{"title":"SQL Review CI","href":"/gitops/migration-based-workflow/sql-review-ci"},{"title":"Release","href":"/gitops/migration-based-workflow/release"},{"title":"Limitations","href":"/gitops/migration-based-workflow/limitations"}]},{"group":"State-Based Workflow (SDL)","pages":[{"title":"Overview","href":"/gitops/state-based-workflow/overview"},{"title":"Develop","href":"/gitops/state-based-workflow/develop"},{"title":"SQL Review CI","href":"/gitops/state-based-workflow/sql-review-ci"},{"title":"Release","href":"/gitops/state-based-workflow/release"},{"title":"Limitations","href":"/gitops/state-based-workflow/limitations"}]},{"group":"Best Practices","pages":[{"title":"Overview","href":"/gitops/best-practices/overview"},{"title":"File Organization","href":"/gitops/best-practices/file-organization"},{"title":"Migration Guidelines","href":"/gitops/best-practices/migration-guidelines"},{"title":"Git and CI/CD","href":"/gitops/best-practices/git-and-cicd"},{"title":"SQL Review and Security","href":"/gitops/best-practices/sql-review-and-security"},{"title":"Performance Optimization","href":"/gitops/best-practices/performance"}]},{"group":"Troubleshooting","pages":[{"title":"Overview","href":"/gitops/troubleshooting/overview"},{"title":"Release and Plan Issues","href":"/gitops/troubleshooting/release-and-plan"},{"title":"Rollout Issues","href":"/gitops/troubleshooting/rollout"},{"title":"SDL Issues","href":"/gitops/troubleshooting/sdl-issues"},{"title":"CI/CD Issues","description":null,"href":"/gitops/troubleshooting/cicd-issues"}]}]},{"group":"Appendix","pages":[{"title":"Review Rules","href":"/sql-review/review-rules"},{"title":"Error Codes","description":null,"href":"/sql-review/error-codes"}]}]},{"tab":"Access Control","pages":[{"title":"Access Control","href":"/security/database-permission/overview"}]},{"tab":"Administration","pages":[{"title":"Administration","href":"/ai-assistant"}]},{"tab":"Tutorials","pages":[{"title":"Tutorials","href":"/tutorials/risks-best-practice"}]},{"tab":"API Reference","href":"https://api.bytebase.com"},{"tab":"Changelog","pages":[{"title":"Changelog","href":"/changelog/bytebase-3-24-1"}]}]},"basePath":"","title":"Review Rules - Bytebase Docs","buildId":"dpl_FWZhTb2vab28gFGFH4ojka6qEznQ","deploymentId":"dpl_FWZhTb2vab28gFGFH4ojka6qEznQ","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-CE4cYsJE.js","lightbox-handle-r17bVUz3.js"]}