如何在phpmyadmin中保存/导出设计器页面?

问题描述 投票:0回答:2

我在 PHPMyAdmin 的设计器选项卡中有很多页面。我如何导出它?所以我可以将它导入到任何其他笔记本电脑中。 PHPMyAdmin 设计器选项卡中我的页面之一

phpmyadmin designer table-relationships
2个回答
3
投票

设计器布局保存在表

phpmyadmin
中的 phpMyAdmin 配置存储数据库(通常为
pma__designer_coords
)中。您可以将该表复制到其他系统(或该表中的值)以复制您的设置。


0
投票

设计器页面作为 IndexDB 存储在应用程序中。

我们可以将其导出为 json 结构,我们可以将其存储在任何地方并稍后导入。

为此,我在浏览器控制台中使用了以下脚本:

// Export Script
var dbName = "pma_designer";
var storeNames = ["table_coords", "pdf_pages"];

var connection = indexedDB.open(dbName);

connection.onsuccess = (e) => {
    var db = e.target.result;
    var data = {};

    var transaction = db.transaction(storeNames, "readonly");
    var objectStore1 = transaction.objectStore(storeNames[0]);
    var objectStore2 = transaction.objectStore(storeNames[1]);

    var allData1 = objectStore1.getAll();
    var allData2 = objectStore2.getAll();

    allData1.onsuccess = function() {
        data[storeNames[0]] = allData1.result;

        allData2.onsuccess = function() {
            data[storeNames[1]] = allData2.result;

            console.log(JSON.stringify(data));
        };
    };
};

我们可以简单地复制该字符串的输出。

接下来,当我们希望将此数据导入到不同的会话时,我们需要反转该过程。

// Import Script

// Simply paste the json output in the var below. Value for reference only.
var jsonExportdata = {"table_coords":[{"dbName":"my_db","tableName":"my_table","pdfPgNr":1,"x":640,"y":11,"id":1}],"pdf_pages":[{"dbName":"my_db","pageDescr":"Fancy Design I Want to Share!","tblCords":[1],"pgNr":1}]}
var dbName = "pma_designer";
var storeNames = ["table_coords", "pdf_pages"];


var connection = indexedDB.open(dbName);
connection.onsuccess = function(event) {
    var db = event.target.result;

    var transaction = db.transaction(storeNames, "readwrite");
    var objectStore1 = transaction.objectStore(storeNames[0]);
    var objectStore2 = transaction.objectStore(storeNames[1]);

    jsonExportdata[storeNames[0]].forEach(item => {
        objectStore1.put(item);
    });
    jsonExportdata[storeNames[1]].forEach(item => {
        objectStore2.put(item);
    });

    transaction.oncomplete  = function() {
        console.log("Data imported successfully");
    };
    transaction.onerror = function(event) {
        console.log("Data import failed:", event.target.error);
    };
};
connection.onerror = function(event) {
    console.log("Failed to open IndexedDB:", event.target.error);
};

完成此操作后,我们现在应该能够在新的

phpmyadmin
会话中打开导入的设计器页面。

参考图片:

Application IndexDB data structureOpen Page LocationSuccessful Result Showcase

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.