{"id":20603612,"url":"https://github.com/kayw-geek/sql-order-analyse-tools","last_synced_at":"2026-04-21T14:31:21.098Z","repository":{"id":118926426,"uuid":"436261828","full_name":"kayw-geek/sql-order-analyse-tools","owner":"kayw-geek","description":"A tool used to check the order of columns in SQL table structure.","archived":false,"fork":false,"pushed_at":"2021-12-09T03:13:07.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T02:12:09.413Z","etag":null,"topics":["sql","sql-analyse","sql-report"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kayw-geek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-08T13:42:42.000Z","updated_at":"2021-12-09T03:09:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"2e8abacc-44b5-40f9-8fbd-1a0b2ace40bb","html_url":"https://github.com/kayw-geek/sql-order-analyse-tools","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayw-geek%2Fsql-order-analyse-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayw-geek%2Fsql-order-analyse-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayw-geek%2Fsql-order-analyse-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kayw-geek%2Fsql-order-analyse-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kayw-geek","download_url":"https://codeload.github.com/kayw-geek/sql-order-analyse-tools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242249034,"owners_count":20096784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sql","sql-analyse","sql-report"],"created_at":"2024-11-16T09:17:56.814Z","updated_at":"2026-04-21T14:31:16.071Z","avatar_url":"https://github.com/kayw-geek.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sql-order-check-tools\n\nA tool used to check the order of columns in SQL table structure.\n\nIt can help you find out nonstandard tables in a large number of SQL files, and output reports to help you optimize your columns order.\n\n# Configuration description\n\n```php\n// SQL_PATH: Your table structure file path.\ndefine('SQL_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR . 'mysql' . DIRECTORY_SEPARATOR . 'mysql.sql');\n// CACHE_FILE_PATH: Save path and suffix of cache file when configuration `use_cache` is turned on.\ndefine('CACHE_FILE_PATH', getcwd() . '/.' . md5_file(SQL_PATH) . '.sql_report_cache');\nconst ERROR_CODE        = 0;\nconst SUCCESS_CODE      = 1;\n// Message output when the program detects no abnormality.\nconst SUCCESS_MESSAGE   = 'Good job!';\n// Unspecified remaining columns.\nconst REMAINING_COLUMNS = '...';\nconst CONFIG            = [\n    'sql_file_path'     =\u003e SQL_PATH,\n\n    'similar_adjacent'  =\u003e true, // Open similar columns sorting, e.g. user_name, user_age, user.\n    'use_cache'         =\u003e true,\n    'sql_order_rules'   =\u003e [\n        'id|_id', // If there is an `id` column in the table, it will be ranked first; if there is a field like `xxx_id`, it will be ranked after the `id`.\n        // 'type|_type',\n        // 'category|_category',\n        // 'status',\n        REMAINING_COLUMNS, // This is the only place where similar adjacent rules are used\n        'created_at',\n        'updated_at',\n        'deleted_at',\n    ],\n    'ignore_tables' =\u003e [\n//         'addresses', // Tables that ignore some special rules.\n    ],\n];\n```\n# How to use\n\nPut your MySQL table structure file in the specified folder.\nExecute `./src/sql-order-analyse-tools` in the terminal.\nExecute `--clean-cache` clean cache files.\n\n# Analysis report\n\n\u003cimg width=\"890\" alt=\"report\" src=\"https://user-images.githubusercontent.com/29700073/145230629-e8c8fb5d-3b29-4d3c-ae78-09761ce2310a.png\"\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayw-geek%2Fsql-order-analyse-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkayw-geek%2Fsql-order-analyse-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkayw-geek%2Fsql-order-analyse-tools/lists"}