Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Can't create VARCHAR column via API #60

Open
benhaynes opened this issue Oct 25, 2018 · 0 comments
Open

Can't create VARCHAR column via API #60

benhaynes opened this issue Oct 25, 2018 · 0 comments
Labels

Comments

@benhaynes
Copy link
Member

From directus created by bensteers : directus/directus#2172

Creating a VARCHAR column via the API reports a SQL error:

POST query to /api/1.1/tables/mytable/columns

Working query

request: {'column_name': 'number', 'data_type': 'INT'}
response: {'meta': {'type': 'item', 'table': 'directus_columns'}, 'data': {'id': 'number', 'name': 'number', 'column_name': 'number', 'type': 'INT', 'column_type': 'int(11)', 'length': 0, 'precision': 10, 'scale': 0, 'sort': 9999, 'default_value': None, 'nullable': True, 'key': '', 'extra': '', 'extra_options': [], 'options': [], 'table_name': 'nodes', 'required': False, 'system': False, 'ui': 'numeric', 'hidden_input': False, 'relationship': None, 'comment': "''", 'relationship_type': None, 'related_table': None, 'junction_table': None, 'junction_key_right': None, 'junction_key_left': None}}

The query with an error

request: {'column_name': 'words', 'data_type': 'VARCHAR'}
response: {'success': False, 'error': {'message': 'Statement could not be executed (42000 - 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \'DEFAULT NULL COMMENT "\'\'"\' at line 1)'}, 'code': 0, 'class': 'Zend\\Db\\Adapter\\Exception\\InvalidQueryException', 'file': '/var/www/html/vendor/zendframework/zend-db/src/Adapter/Driver/Pdo/Statement.php', 'line': 244}

Version Info

  • Directus version and branch (Or commit hash): 6.4.9
  • PHP version: 7.1.17
  • MySQL version: Ver 14.14 Distrib 5.5.60, for debian-linux-gnu (x86_64) using readline 6.3
  • Web server: (Ex. Apache, nginx or IIS?)
  • OS name and version: Debian GNU/Linux 8 (jessie)

Steps to Reproduce

  1. create table
  2. make the two requests above
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant