Working with multi-tenancy/multi db in laravel - mysql

I'm working for the first time on a multitenacy application with multidatabase for each tenant made with laravel using the Tenancy for Laravel Saas - Boilerplate .
Being the first time for me working on such kind of application, I've read the whole well done documentation that they have but unfortunately I'm still really confused about one thing.
I use TablePlus to check my db records but on table plus, I can only see the Central DB not the tenant's database.
My question is, how can i check all the databases created for each tenant?
The above package is generating for each tenant a db named tenantid************************, how can i see what I'm writing into this db??
Hope somebody can help me to clear this doubt.
Thank you very much.

For multiple databases in table plus, you can open other databases for the current connection. In the UI top bar there is button left to the "sql" button. Alt. go to Connection/Open a database (Shortcut on mac "command + K")

Related

Synchronizing SQLite and MySql together

I am trying to synchronize 2 different type of database together. Here is a better explanation of what I am trying to do:
I have the MySQL database on a server with the main database. I have an application installed on multiple computers.
I need the main database to be updated with the modification inside the computers and I need the computer version to get the updates from the main database.
I have seen the replication option in MySQL but it's not exactly what I want to do. I have seen other stuff like REPLACE INTO but I still don't see a clear solution.
I'm not asking for a full solution but maybe a good pseudocode or some cool functionality so I can try to implement it. This will be used on my end of school project.
I obviously have a timestamps on each row so I can detect changes.
This is how I would do this if I had an app that will run in different SQL environments.
It will be cleaner if you do the communication between yourApp & DB through some php class. This class instance will be created based on user's SQL version. Then, it is for your code in the class to decide how to connect to your DB.

Visibility of databases in cloudbees?

I'm looking into using CloudBees for some application prototyping. I am using free accounts right now, I am not paying any subscriptions at the moment.
The first step for me is to create a MySQL database to host my application's data. I've done so (and it was pretty easy!). I also use Liquibase to manage the database (I've started this work using local H2 databases for the pre-prototyping), and I've been able to construct everything as expected.
As part of checking whether liquibase created the tables, I brought up the MySQL database in NetBeans. And, it did function well. But I can also see other schemas as well as the schema I just created. They're all innocently named (test, test_6hob). But, I can see the tables and view their data.
My question is around the visibility of the data that's in the CloudBees database. Is the database created for the free accounts viewable to other people connecting to the same machine? Does this change if I use a paid account? Or is it more the nature of how the database was created? I can see other schemas (and their data) but I have no idea if other people can see mine? Is there a permissions-aspect I need to ensure I set? I've fairly ignorant with the inner-workings of MySQL.
While this is a prototype, were I to move into using CloudBees for production applications, I wouldn't want the data to be visible to anyone who happened to connect to the same database as my application. It's entirely possible that I'm missing something in this new cloud world. :)
Thanks for any info
All CloudBees MySQL databases are secured separately (although will be in shared instances unless you have a dedicated server) - they are not readable by any other account by default.
However, it is possible for the database owner to grant access to users from other accounts on that same database server if you really wanted to - even though it makes very little sense to do so (and your special user configuration will be lost during a failover).
So this is what has happened for the test databases that you can see - the database owner has opened up security on those databases / tables.
This question is probably off topic but i'll bite anyway. The database data is private to your account. Actual hardware/vm's maybe shared but the data/database is not.

How to execute SQL queries inside MySQL workbench

I am developing an application using Django framework. As you may know the workflow is you first describe your objects in Python classes and then you synchronize the database.
I made a MySQL Workbench EER diagram. Since then I continued to develop the application, so the database model is not updated in the EER diagram nor the MySQL Workbench model.
I tried to synchronize it using the built-in feature "Synchronize with Any Source" of MySQL Workbench, but this feature is not working for some reason and causes a segmentation fault. The queries to be executed inside the MySQL Workbench model are displayed but at the last step I get an empty SQL alter script. I tried manually copying the queries in that script and clicking the "Execute" button, but I had no luck with that. I think MySQL stores queries internally. Anyway. I submitted the bug to MySQL Workbench developers here and now it is fixed, but not yet released. I am now looking for a workaround while waiting for the next release.
Although I have a specific problem, the question remains generic.
Is it possible to execute queries on the MySQL Workbench model in order to alter it?
Did you try the "Forward Engineer" option? It allows you to reflect all the changes that were made to your table relations directly to the database which is a pretty useful functionality.
There are some catches though like the inability to maintain existing data every time forward engineering is performed however this can be compensated by entering some example data which will be shipped with the ER diagram the next time you perform "Forward engineer".

Synchronize 2 database in django

I have 2 different server running django in it. (using postgre)
Both has the same user table.
I wanted to synchronize the user table, as if I update or delete user in one server then the 2 db should also get updated.
I guess replication is not a solution for my case.
Can anyone point me in right directions. or any link or reference will be helpful.
Both server are running different django code.
Thanks,
I don't know how to do this in PostgreSQL, but in MySQL you could create database VIEW pointing to a table in another database. This way you could reuse the existing auth_user table in the other sever.
I would take a look at pgpool-II. I haven't used it myself, but it's been recommended to me for similar purposes and after a bit of research I came to the conclusion that it's one of the better projects out there.

delphi and mysql DB help

I want to create an application for my friends ,Its like a slam book
I want like this
in nameditbox when i entered name it has to fetch data from database and have to display in respected fields
example : nick name editboz :nick
number:1111
2.moreover i want to add to database new entry from my application by clicking add button
is it possible to edit already existed friends name details ?
I never worked with mysql (even i dont know much ), and i never worked in delphi in accordance with mysql ,not normal dlephi though .
is there any already done project ?if yes please link me i want to learn
hope some one can help me in this
thanks in advance
I have to say I haven't tried this with MySQL, however hope this helps.
For part 1 of your question:
I suggest the easiest way is to use the free MySQL ODBC driver from http://dev.mysql.com/downloads/connector/odbc/5.1.html
Delphi supports connecting using ODBC (Open Database Connectivity). Essentially, Delphi doesn't know about any of the particular features of the MySQL database, but knows about a smaller set of features common across the majority databases.
If you can get this ODBC driver to connect to MySQL, then you will be able to look at all of the good examples on the Internet and in the supplied Delphi help files showing you how to:
Create an ODBC data source in Windows ODBC Manager.
Open a TDatabase connection to the MySQL ODBC data source
Connect a TTable to a TDatabase
Connect a TDataSource to a TTable
Connect a TDBEdit to a TDataSource
You will need to learn yourself how to connect these to a particular table in your MySQL database.
Connecting these components together like this should give you a working example for what you are trying.
You should find lots of good tutorials showing you how to connect to an ODBC database on the Internet.
For part 2 of your question:
Once you have done part 1, reaching part 2 is a small step from there.
Connect a TDBNavigator to the TDataSource.
This will enable you to navigate the table of data and will enable an add/edit/delete feature for the table allowing a new row, deletion of a row and editing of a row.
Best of luck with this.