php-crud-api icon indicating copy to clipboard operation
php-crud-api copied to clipboard

Create database

Open f0rever-johnson opened this issue 7 years ago • 10 comments

Thank you for your hard work!! I just have a request. Is it possible to create a database from this script? Like POST /"DATABASE NAME" ? & then create a table on that database? essentially an endpoint to dynamically creating databases & tables.

f0rever-johnson avatar Apr 22 '18 20:04 f0rever-johnson

Is it possible to create a database from this script?

No, but it is not a bad idea. I'll register it as a feature request.

This might be added (at some point) to v2 as that version has more advanced meta data support.

mevdschee avatar Apr 24 '18 03:04 mevdschee

Thanks!! That would be awesome. Right now I’m writing stored procedures with prepare statements in MySQL, & then calling them via the php-sp-api. Do you think that is a viable solution?

Everaldlee Johnson

On April 23, 2018 at 11:27:09 PM, Maurits van der Schee ( [email protected]) wrote:

Is it possible to create a database from this script?

No, but it is not a bad idea. I'll register it as a feature request.

This might be added (at some point) to v2 as that version has more advanced meta data support.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mevdschee/php-crud-api/issues/376#issuecomment-383791796, or mute the thread https://github.com/notifications/unsubscribe-auth/AUK79Bw1JsTvm0DCsvI3ZpLtbrbXCO7rks5trpuNgaJpZM4TfBmy .

f0rever-johnson avatar Apr 24 '18 03:04 f0rever-johnson

Do you think that is a viable solution?

Sure it is.. :+1:

mevdschee avatar May 20 '18 20:05 mevdschee

@f0rever-johnson I'm aiming for such support in v2. I have reflection, table renames and column changes implemented currently.

mevdschee avatar Jun 11 '18 14:06 mevdschee

Hey, any update to dynamically creating databases/tables?

f0rever-johnson avatar May 19 '21 00:05 f0rever-johnson

Hi Everaldlee, Thank you for asking this question. Creating tables is now possible, creating databases is not (yet) supported. I hope this helps you. Kind regards, Maurits

mevdschee avatar May 19 '21 00:05 mevdschee

I am not seeing anything regarding creating tables. Is there an example or a specify endpoint I should be using?

f0rever-johnson avatar May 19 '21 00:05 f0rever-johnson

You need to enable the 'columns' controller, see also: https://github.com/mevdschee/php-crud-admin/blob/main/src/index.php

mevdschee avatar May 19 '21 00:05 mevdschee

I enabled the columns controller. However I am unsure on how to access the endpoint to create a table. Essentially I have a sample table(s) I would like to duplicate whenever a new user is created in my identityprovider.

f0rever-johnson avatar May 25 '21 01:05 f0rever-johnson

I have a sample table I would like to duplicate

This is not yet supported, although one could write this as middleware, executing certain queries when a new authenticated user is encountered.

mevdschee avatar May 25 '21 13:05 mevdschee