Генератор SQL CREATE TABLE и DDL из JSON

Преобразуйте пример JSON в черновик DDL для PostgreSQL, MySQL, SQLite, SQL Server или Oracle.

// about

Об этом инструменте

Инструмент определяет столбцы и SQL-типы из JSON-объекта и создает черновик DDL. Вложенные значения представляются как JSON или текст; перед продакшеном скрипт нужно проверить.

Как использовать

  1. Вставьте показательный JSON-объект.
  2. Выберите базу данных и укажите имя таблицы.
  3. Создайте DDL и проверьте типы, ограничения, индексы и связи.

Зачем используют этот инструмент

  • Быстро превращайте пример JSON в определение SQL-таблицы.
  • Выбирайте PostgreSQL, MySQL, SQLite, SQL Server или Oracle.
  • Используйте результат как основу для проверки столбцов и типов.

Часто задаваемые вопросы (FAQ)

Создает ли инструмент полную схему базы?

Нет. Он создает черновик таблицы по одному JSON-примеру. Добавьте ключи, ограничения, индексы, связи и миграции для приложения.

Руководства · Данные · 6 мин чтения

Руководство по UUID: v4 против v7 и UUID как первичный ключ в базе данных

Строки вроде 550e8400-e29b-41d4-a716-446655440000 повсюду обозначают заказы, файлы и API-запросы. Узнайте, как генерируются UUID и какую версию выбрать.

UUID (Universally Unique Identifier) — это 128-битный идентификатор, который позволяет любому создавать неконфликтующие ID без обращения к центральному серверу. В Microsoft его называют GUID. Действующий стандарт — RFC 9562, опубликованный в 2024 году.

Структура UUID, различия между версиями, почему коллизии практически невозможны и почему для первичных ключей UUID v7 всё чаще вытесняет v4.
Читать →
Сделать с ИИ

Создайте этот инструмент сами с помощью ИИ

Нужна своя версия? Скопируйте промпт в чат с ИИ или сохраните файл навыка для ИИ-агента. В них описаны функции, особые случаи и тесты, которые мы использовали.

Промпт и навык даны на английском — ИИ-инструменты хорошо его понимают.

Промпт-задание для ИИ

Вставьте как есть в Claude, ChatGPT или Gemini.

You are an experienced full-stack web developer. Build a web tool called "Генератор DDL из JSON" that meets the requirements below.

## Goal

Build a tool that generates database CREATE TABLE statements from a JSON sample.

## Core features

- Choose MySQL, PostgreSQL, SQL Server or Oracle
- Infer column types from values
- Choose a primary key
- Option to map nested objects and arrays to child tables or JSON columns
- Copy result

## Inputs

- A JSON object or array of objects
- Database, table name, primary key

## Outputs

- CREATE TABLE SQL
- Reason for each inferred type

## Edge cases and handling rules

- Pick the widest type across rows (int + decimal → DECIMAL)
- Infer date/time types from ISO 8601 strings
- Allow NULL where null values appear
- Respect each database's identifier quoting and reserved words

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- {"id":1,"price":9.9,"createdAt":"2026-10-28T09:00:00Z"} gives integer, decimal and timestamp types
- PostgreSQL output uses double-quoted identifiers
- PRIMARY KEY appears when a key is chosen

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

Навык (SKILL.md)

Сохраните как .claude/skills/build-json-ddl-generator/SKILL.md, чтобы агенты вроде Claude Code использовали его при каждой доработке инструмента.

---
name: build-json-ddl-generator
description: Use when building or changing a Генератор DDL из JSON tool. Build a tool that generates database CREATE TABLE statements from a JSON sample.
---

# Build: Генератор DDL из JSON

## Goal

Build a tool that generates database CREATE TABLE statements from a JSON sample.

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Choose MySQL, PostgreSQL, SQL Server or Oracle
- Infer column types from values
- Choose a primary key
- Option to map nested objects and arrays to child tables or JSON columns
- Copy result

## Inputs

- A JSON object or array of objects
- Database, table name, primary key

## Outputs

- CREATE TABLE SQL
- Reason for each inferred type

## Rules

- Pick the widest type across rows (int + decimal → DECIMAL)
- Infer date/time types from ISO 8601 strings
- Allow NULL where null values appear
- Respect each database's identifier quoting and reserved words
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] {"id":1,"price":9.9,"createdAt":"2026-10-28T09:00:00Z"} gives integer, decimal and timestamp types
- [ ] PostgreSQL output uses double-quoted identifiers
- [ ] PRIMARY KEY appears when a key is chosen

Советы по работе с ИИ

  • Укажите стек (React, Vue или чистый HTML) в первой строке, чтобы код подошёл к проекту.
  • Попросите ИИ выполнить перечисленные тесты и показать результаты до принятия кода.
  • Не вставляйте настоящие пароли, данные клиентов и API-ключи; используйте примеры.